what I do is tag my waypoints, then add a start function like this (it's in C# but I imagine it's the same for JavaScript)
Start()
{
waypoints = GameObject.FindGameObjectsWithTag("waypointTag");
}
If you do it this way though you'll have to change waypoints to a GameObject instead of a transform, and then use waypoint[currentwaypoint].transform.position
↧