Hi all, I am trying to add waypoints to the array in C#. But my code is giving me the error. I checked potentialWaypoints length 18 as expected. Its showing the error at line indicated in code “IndexOutOfRangeException: Array index is out of range.” my code is,
public Transform[] waypoints=new Transform[18];
private int i=0;
void start()
{
GetWaypoints();
}
void GetWaypoints ()
{
Transform[] potentialWaypoints = waypointContainer.GetComponentsInChildren<Transform>();
foreach(Transform potentialWaypoint in potentialWaypoints)
{
if (potentialWaypoint != waypointContainer.transform)
{
/*Error=====>*/ waypoints *= potentialWaypoint;*
-
i++;*
-
}*
-
}*
- }*