I have a class like this:
[System.Serializable]
public class arrayData
{
public List<arrayData2> Levels;
}
public List<arrayData> Zones;
[System.Serializable]
public class arrayData2 { }
And I should add an item to the Levels
collection:
void Start()
{
Zones.Add(new arrayData());
Zones[0].Levels.Add(new arrayData2());
}
The method keeps giving this error at runtime:
NullReferenceException: Object reference not set to an instance of an object
Does anybody know what am I missing?