Scriptable object with custom editor resets part of data on play

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?

Are you dirtying it properly with something like Undo.RecordObject() ?

Yes. I also tried setting it dirty, but I don’t think the problem lies there, because I can change focus in the inspector, and the changed params are there when I return, they disappear only when I press play.

These params can ONLY be reference to other assets. Is that indeed the case? You could not of course put a reference to something in the scene (transient) into a ScriptableObject instance (permanent on disk).

The “value” field in the class (array of which I want to store) is referring to a value (of type Type) I set in inspector. For now I tested only numerical primitives. And other fields in the class are obviously persistent.