Initializing List of generic type via editor - Doesn't work?


I want to initialize a List of Gameobjects via Editor. Does this work?


public List<GameObject> gameObjectList = new List<GameObject>();

The List is shown in the Editor and I can type in the size.
I typed in 2.
Then i added 2 Prefabs via drag and drop.

But the List is always empty when I try to get some Objects back via: gameObjectList[index]… so there is nothing initialized…

Is there are List Type with which I can collect gameobjects via editor?

Access the list via SerializedObject (e.g. serializedObject.FindProperty (“[0]”).objectReferenceValue).

Make also sure that changes to your objects are applied and saved to disk hitting Ctrl+S.