A little riddle about lists

Hi !

Something popped into my mind. When you want to make a list of X (X being a type), you write :

public var listX : X [];
public var listGO : GameObject [] = new GameObject [5];

But if you had to put listGO inside listX (as listX [0]), what would be X ?

Object ?

First and most important: You don’t use an list there at all. That are arrays and arrays work fundamentally different than lists.

With UnityScript, likely Object and then you need to parse the thing you fetched from the list through bla as GameObject[ ]

what I’ve not checked is if you could use generics in this case (requires Unity 3, UnityScript has no generics prior to u3 b6)
Because if you can then it would look like

import System.Collections.Generic;

public var ListX : List<GameObject[]> = new List<GameObject[]>();
public var listGO : GameObject [] = new GameObject [5];
public var ListX : List<GameObject[]> = new List<GameObject[]>();

puzzled

Oh, well…shrug off I will just use Object [ ]. Thanks you !