I am working on an Editor Mode tool that should make a snapshot of certain objects in a scene so I can reset the state of those objects after they were modified in a distant future.
I thought it is a trivial case since each game object has the InstanceId. Unfortunately, I found out that those InstanceId’s are changing after I close and reopen the editor.
I cannot use GameObject.Find since I have object trees with the same objects names.
Do you have any suggestions or can point me in a right direction?
It is probably best to just add a specific identifier component to each GameObject, giving it a unique identifier.
I’ve seen other tools do this and it seems to work out pretty good. That way you’re playing in a “safe” way. Be sure to use Undo.RecordObject() so that the change of adding a component gets saved.