- Home /
Question by
steinbitglis · May 24, 2013 at 09:49 AM ·
scriptableobjectundo
Is there any way to implement 'Undo' for ScriptableObject assets?
I have trouble implementing 'undo' for a few of my config assets (ScriptableObject's).
[CustomEditor(MyConfig)]
class MyConfigEditor (Editor):
config as MyConfig
def Awake():
config = target as MyConfig
def OnInspectorGUI():
if GUILayout.Button("Change config"):
Undo.RegisterUndo(config, "Changed config")
... changing the config
EditorUtility.SetDirty(config)
It seems like undo operations are reflected in the file system, but not in the inspector.
Comment
Answer by gameDevMode · Dec 17, 2019 at 01:47 AM
I was having the same issue but solved it using
Undo.RecordObject(config,"Changed config");
Your answer
![](https://koobas.hobune.stream/wayback/20220613102834im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Modifying and Saving Scriptable Objects: SetDirty vs. Undo 1 Answer
Undo issues in EditorWindow 0 Answers
Why is play mode reverting my scriptableobject to a previous serialized state? 2 Answers
Changes to custom serializable object not saved to disk 1 Answer
Wrong serialization when using ScriptableObject + [System.Serializable] + inheritance 2 Answers