You haven’t created any space for the game object in the array. That is ‘temp’ is a pointer that has not be initialized. If you know the number of entries that you will be filling, then you can create space this way:
private var temp : GameObject[] = new GameObject[5];
If you don’t know the number of entries you will need, then you can use a .NET generic List.
For more info on Arrays and Collections (including generic Lists) see: