Custom inspector how to make nested List play nice

nested list variable in the script :

public List<List<Mission>> mMissionList = new List<List<Mission>>();

when i try to do this

SerializedProperty _stageList = mSrlObj.FindProperty("mMissionList"); 
        Debug.Log(_stageList); // returns null

but if i change the variable to

public List<Mission> mMissionList = new List<Mission>();

result

SerializedProperty _stageList = mSrlObj.FindProperty("mMissionList"); 
            Debug.Log(_stageList); // returns SerializedProperty

the mMissionList is tagged with a [SerializeField], and the Mission class is tagged with [System.Serializable], so i’m not sure why a nested list would cause the inspector script to go nuts. i have a feeling i’m missing something but i can’t quite make out what is it.

any guide is much appreciated

turns out it was because unity cannot serialize nested lists. you’d need a wrapper class to do something similar. [i got my hint from this question.][1]

in my case, it was something like this,

[System.Serializable]
public class WrapperClass
{
    [SerializeField]
    public List<MyClass> mMyClassList;
}

making a list of the wrapper that contains the list

List<WrapperClass> mNestedList;

using it

MyClass tempClass = mNestedList*.mMyClassList[j];*

[1]: Serialize Nested Lists - Unity Answers