Parsing error for List <GameObject>

Hi,

I am trying to create a list of GameObject in C#.

I used the namespace,

using System.Collections.Generic;

and declared and assigned:

List<GameObject> theObject = new List<GameObject>();

Yet I get an error: Parsing error.

Any help would be greatly appreciated. Thank you!

Nevermind.

I found out that for the Unity iPhone, it doesn't support System.Collections.Generic. So the List is not available for the iPhone.

So I just used:

GameObject[] theObject = new GameObject[10];

and have it so that when it reaches slot 9 array, it loops back to 0. I am sure this is faster and much more efficient too.

yes if you are on iphone you can not use generics but you can use List from System.Collections. all items in the list are of type System.Object and you need to cast things when you want to put them in the list or get them from the list. you should cast your gameobject to object when adding it to the list and cast your object to gameobject when getting it. you should type system.object because you can not use unityengine.object for this and it's a totally diferent thing.