Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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;
like image 389
George F Avatar asked Sep 06 '25 03:09

George F


1 Answers

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

like image 193
Berk Askin Avatar answered Sep 07 '25 20:09

Berk Askin