It’s quite simple to record actions but, how can I ask the editor NOT to record them on a specific MonoBehaviour or ScriptableObject?
The recording of actions is implemented on each tool that modifies it.
So if you are talking about a default Editor through the Inspector, you would have to create a custom Editor.
On IMGUI, its simple as instead of calling .ApplyModifiedProperties()
on your SerializedObject
, you would call
ApplyModifiedPropertiesWithoutUndo
after drawing your property controls.
Or ignore SerializedObjects all together and just directly modify your instance properties.
Unity - Manual: Extending the Editor with IMGUI (unity3d.com)
Unity - Scripting API: SerializedObject.ApplyModifiedProperties (unity3d.com)
Unity - Scripting API: SerializedObject.ApplyModifiedPropertiesWithoutUndo (unity3d.com)
With UIToolkit i think it would be a little more cumberstone, as the default way of binding a PropertyField
to the SerializedProperty
of a SerializedObject
applies ApplyModifiedProperties
automatically. So i think you would need to manually create your desired VisualElement
for each property, and manually bind through TrackPropertyValue (ignoring binding paths, and applying the modified property value manually, then calling ApplyModifiedPropertiesWithoutUndo), or through the Runtime Binding System (dataSource
+ dataSourcePath
, which deals directly with instances without any connection to SerializedObject / Undo)
Very helpful @Canijo. I’m making a custom editor, so calling ApplyModifiedPropertiesWithoutUndo is what I need.
Thank you so much.