object list not serializing

i have an editor window that modifies variable of scene gameobject. the variable was List and it was working fine, but then i changed modified the code and i needed it to be List. and now it’s not serializing (it’s cleared when entering play mode).

//Before
[SerializeField]
public List<GameObject> returnValues;

//After
[SerializeField]
public List<object> returnValues;

You can’t serialize object. Make a List of a serializable object type instead e.g. Vector3, int, float, … check this.

If you want to hold custom classes e.g. MyData make sure you mark the class as Serializable i.e.:

[System.Serializable]
public class MyData {
    public int intValue;
    public UnityEngine.Object objectValue;
    public float floatValue;
    public string stringValue;
    ...
}

[SerializeField]
List<MyData> returnValues;

You can find plugin here (easy to implement )
http:// Unity Asset Store - The Best Assets for Game Making