c# - Infinite objects declaration in script -
i have script in unity holds checkpoints in racing game. don't know how many checkpoints on racetracks. limited 5:
but, allow map makers insert more checkpoints. doesn't work:
public list<gameobject> checkpoints = new list<gameobject>();
so best way this?
wouldn't defining array of checkpoints work?
public gameobject[] checkpoints;
i don't have access unity @ moment, should allow enter (reasonable) number of gameobjects via inspector checkpoints array.
this on unity answers similar question: http://answers.unity3d.com/questions/245024/public-array-of-gameobjects.html
taking wild guess here, error list1' not found
? in case you'll have add using system.collections.generic;
able use c# lists.