|
Hey, so what I'd like to do is make an array of children, then move the player to the child in the the array that I choose, heres the code; WayPointContainer is an empty gameobject with empty gameObjects as children.
the error I get is ; ArgumentOutOfRangeException: Index is less than 0 or more than or equal to the list count. Parameter name: index 1 does this mean it isn't adding the transforms of the children? if so how do I fix this?
(comments are locked)
|
|
Array indices start at 0. You have only one item, so to access it you need to use index 0, but CurrentWayPoint is 1 (that is the argument that is out of range). But enemywaypointcontainer has 2 children, so the parent is 0 and the two children are 1,2?
May 01 '11 at 05:10 AM
Jason Hamilton
Instead of Add(), try AddRange().
May 01 '11 at 12:22 PM
Molix
is that something available with javascript arrays?
May 02 '11 at 07:25 AM
Jason Hamilton
Yes, they do have it.
May 02 '11 at 02:23 PM
Molix
(comments are locked)
|

Remember to use WayPoints.Shift() after adding the children to remove the parent.