Getting value out of lists of lists

Hello there, I’m new from developing and right now I struggle with making lists, my code contain a lot of variables and I love to stay organize. Right now I’m trying to making lists of lists to replace the old stystem, but I dont have the idea of how to get the value out, thank you so much for helping!! My code look like this:

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

Is this a simple syntax question? Start with tutorials on List… it’s no different if the T itself is another List inside of it. It will look something like:

var value = nestedList[ outerIndex].sampleList[ innerIndex];

There are limitations to what Unity’s serialization can present however, with rules about marking stuff as serializable (as you have), etc.

2 Likes

Thank you so much! It work very well!