void Start() { graph = GetComponentInParent <WaypointGraph>(); index = graph.waypoints.IndexOf(this); pos = transform.position; if (transform.childCount > 1) { radius = transform.GetChild(0).localScale.x / 2; } var bh = GetComponent <WayPointBehaviour>(); if (index - 1 >= 0) { prev = graph.waypoints[index - 1]; } if (index + 1 < graph.waypoints.Count) { next = graph.waypoints[index + 1]; } if (bh.targets.Count != 0) { nextR2 = bh.targets[0].GetComponent <Waypoint>(); } }
void Start() { graph = GetComponentInParent <WaypointGraph>(); if (graph == null) { return; } index = graph.waypoints.IndexOf(this); var bh = GetComponent <WayPointBehaviour>(); if (index - 1 >= 0) { prev = graph.waypoints[index - 1]; } if (index + 1 < graph.waypoints.Count) { next = graph.waypoints[index + 1]; } if (bh.targets.Count != 0) { nextR2 = bh.targets[0].GetComponent <Waypoint>(); } }