void Awake() { target = new GameObject("pt").transform; circuit = GameObject.FindObjectOfType(typeof(WaypointCircuit)) as WaypointCircuit; _statistics = GetComponent <Statistics>(); _statistics.target = target; }
public void AddWaypointsFromChildren() { WaypointCircuit circuit = this; var children = new Transform[circuit.transform.childCount]; int n = 0; foreach (Transform child in circuit.transform) { children[n++] = child; } Array.Sort(children, new TransformNameComparer()); circuit.waypointList.items = new Transform[children.Length]; for (n = 0; n < children.Length; ++n) { circuit.waypointList.items[n] = children[n]; } }