Existing ScriptableObjects don't serialize correctly

Hello, I have defined an abstract SO class. I then implemented some classes based on it and instantiated some assets. Afterwards, I noticed that I need an extra int field, so I just a public int field. This field doesn’t appear in the serialization of the ALREADY EXISTING assets (if I open it in a text editor), so all data gets lost. It does appear if I create a new asset. Does anyone have any ideas?

Thanks for the help!

It seems you need to call Editor.SetDirty(asset) on the asset or it doesn’t even try to serialize. Sorry for the trouble!

SO asset changes aren’t saved to disk until you save your project, call AssetDatabase.SaveAssets() or close your project.