I have a class
[System.Serializable]
public class CustomProperty
{
public readonly string name;
public readonly Type type;
public object value;
public CustomProperty(string name, Type type, object value)
{
this.type = type;
this.name = name;
this.value = value;
}
}
and I want to save an array of it in my Scriptable Object. I created a CustomEdtitor of this scriptable object, where I fill CustomEditor’s array and then, when specialized button is pressed (in editor), I clone this array to target’s array (meaning scriptable object gets it’s copy of the needed array). This array is persistant on disabling CustomEditor (eg inspecting another object and then again inspecting the scriptable object), but when I press play, and try to load this array from scriptable object it’s size stays the same but all it’s content is set to null. Is this because System.object is “weird” when it comes to serialization? If it if so, can I somehow seriallize not System.object (value), but firstly cast it to Type type and then serialize it as this type? And if it is not connected at all what should I do?