- Home /
Question by
Jessy · Jan 25, 2013 at 03:17 AM ·
editor-scriptingundo
Is there a way to register undo for all ColorField changes, or name the individual undos?
This code will yield a separate undo for all changes made in the ColorField GUI popup:
EditorGUI.BeginChangeCheck();
Undo.SetSnapshotTarget(target, "Change Color");
Undo.CreateSnapshot();
target.Color = EditorGUILayout.ColorField("Color", target.Color);
if (EditorGUI.EndChangeCheck()) Undo.RegisterSnapshot();
if (GUI.changed)
EditorUtility.SetDirty(target);
I guess it's nice that you can undo all of those operations, but the naming can't be right. The only way that "Undo Change Color" would be precise, is if you only make one change in the popup. Is there some other option?
Comment