George F
George F

Reputation: 43

Why is my List of Lists not showing up in Unity inspector?

I would like to create a list of lists in C#, Unity (so I don't have to create 10 seperated lists). It doesn't show any syntax error, however, even though it's public, it doesn't show up in Unity inspector.

public List<List<Sprite>> listOfLists;

Upvotes: 4

Views: 15737

Answers (1)

Berk Askin
Berk Askin

Reputation: 177

Unity inspector aren't to able serialize nested objects, if you want to do that please create and use class structure.

Example code:

[System.Serializable]
    public class serializableClass
    {
        public List<int> sampleList;
    }
    public List<serializableClass> nestedList = new List<serializableClass>();

If you use these type of structure should see this...

enter image description here

Upvotes: 6

Related Questions