Public List not appearing in inspector

For some reason the list I am attempting to use Is not appearing in the inspector, I have restarted unity several times and that doesn’t seem to work.

Have i done something wrong in the initialisation of the list/array?
3411271--268737--upload_2018-3-3_16-41-46.png

3411271--268736--upload_2018-3-3_16-41-35.png

3411271--268734--upload_2018-3-3_16-40-11.png

1 Like

Unity’s serialization system doesn’t like that. You’ll need another type to wrap the array and create a list of that wrapper type instead.

2 Likes

I am unsure as how to do this, can you link me to something or provide an example please?

Either a class or a struct:

[System.Serializable]
public class GOArray
{
    [SerializeField]
    private GameObject[] _gameObjects;

    // optionally some other fields
}

Then, just use it like

[SerializeField]
private GOArray[] _array;

[SerializeField]
private List<GOArray> _list;
5 Likes

Ah ok, Thank you :slight_smile:

4 Likes