public void Remove(DebugItem item) { var removeMatches = new Action <List <DebugItem> >(list => { int index = 0; while (index < list.Count) { if (list[index].Token == item.Token) { Destroy(list[index].Object); list.RemoveAt(index); } else { index++; } } }); removeMatches(_stationary); removeMatches(_relativeTo); }
public DebugItem AddDots(IEnumerable <Vector3> positions, float radius, Color color, Component relativeToComponent = null, GameObject relativeToGameObject = null) { GameObject parent = new GameObject(); parent.name = PREFIX + "dots"; var children = new List <GameObject>(); Vector3[] posArr = positions.ToArray(); foreach (Vector3 pos in posArr) { children.Add(GetNewDot(pos, radius, color, parent)); } var retVal = new DebugItem(NextToken(), parent, children.ToArray(), GetCenter(posArr), relativeToComponent, relativeToGameObject); AdjustColor(retVal, color); AddItem(retVal); return(retVal); }
public DebugItem AddCube(Vector3 position, Vector3 size, Color color, Quaternion?rotation = null, Component relativeToComponent = null, GameObject relativeToGameObject = null) { GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Cube); obj.name = PREFIX + "cube"; RemoveCollider(obj); obj.transform.position = position; obj.transform.localScale = size; if (rotation != null) { obj.transform.rotation = rotation.Value; } AdjustColor(obj, color); var retVal = new DebugItem(NextToken(), obj, null, position, relativeToComponent, relativeToGameObject); AddItem(retVal); return(retVal); }
public static void AdjustLinePositions(DebugItem item, Vector3 from, Vector3 to, float?thickness = null) { AdjustLinePositions(item.Object, from, to, thickness); }