After changing EditorUtility.SetDirty to Undo.RecordObject my game stopped saving. I feel like Undo.RecordObject is not marking the Scriptable Object as dirty, as adding EditorUtility.SetDirty after modifying the values made it work.
Is this a Unity bug? or this is how it’s supposed to work?
I actually found similar behavior when I worked through my InventoryItem editor. I think Unity doesn’t handle Scriptable Objects/Undo as well when it comes to dirty. My workflow for a property actually looks like this:
int exampleInt;
void SetExampleInt(int value)
{
if(value==exampleInt) return;
Undo.RecordObject(this, "Change ExampleInt");
exampleInt = value;
EditorUtility.SetDirty(this);
}
That’s pretty much what I ended up doing.
Thanks!
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.