- Home /
prefab losing inspector changes made via contextmenu
I have a script that instantiates/removes copies of a button via a contextmenu command. References to the created buttons are stored in a list on a script attached to the parent of the buttons.
I'm using UnityEditor.Undo.RecordObject(); to try and record changes made to the script holding the list and using UnityEditor.Undo.RegisterCreatedObjectUndo(); on the created buttons.
The problem I'm having is that changes made to the list of buttons aren't saved correctly and will revert to none when leaving the scene or entering playmode when the object holding the list is part of a prefab.
I have tested the same script on the same object after unpacking from prefab and the references are saved correctly.
Am I missing something to have the list references be correctly saved in on the prefrab version of the object? (without having the apply it to the prefab object)
Note: have also tried EditorSceneManager.MarkSceneDirty(gameObject.scene); which also didn't work on prefab version of the object
Your answer
Follow this Question
Related Questions
Why can't I undo changes to a prefab? (or to an instance of it after I apply the changes) 1 Answer
Data type to use to create an undo/redo system that tracks blocks added to a scene 1 Answer
Undo GUILayout.Window Drag 0 Answers
Custom editor: undo change to editor property 0 Answers
How to make object come back 2 Answers