I have a script in every scene that assigns a unique ID to each gameObject for a save game purpose.
I must use my own unique ID’s because gameobject Instance Id’s change if I load a scene and there seems to be no way to get gameobjects Local Indentiefier In File.
I have my SaveManager that assigns ID’s to savable classes run in edit mode,
but the id’s it would set would not save.
So I made an editor script for this SaveManager that did this check instead and use EditorUtility.SetDirty ( target );
Now the edited id’s in the savable classes will save.
Problem is that I have to manually do this check every time I want to save.
How can I make a editor script run right before the scene is saved?
Or having it run on a scene load would be an acceptable alternative.
Or can I call EditorUtility.SetDirty from a normal script somehow?