i have done some code to allow my capsule to move from waypoint to waypoint and unity isn't picking up that exists enter image description here
and here is the code my emptybody is called WayPoints all children are called Waypoint through to Waypoint(13)
public class WayPoints : MonoBehaviour
{
public static Transform[] points;
void Awake ()
{
points = new Transform[transform.childCount];
for (int i = 0; i < points.Length; i++)
{
points[i] = transform.GetChild(i);
}
}
}
Edit: after changing to list is now coming up with error enter image description here
new code:
public class Enemy : MonoBehaviour
{
public float speed = 10f;
public static List<Vector3[]> points = new List<Vector3>();
private Transform target;
private int wavepointIndex = 0;
void start ()
{
target = WayPoints.points[0];
}
void Awake ()
{
points = new List<Vector3>();
for (int i = 0; i < transform.childCount; i++)
{
points[i] = transform.GetChild(i).position;
}
}
}