diff --git a/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs b/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs index a1d4a14e4d..e0a6a1f5c6 100644 --- a/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs +++ b/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs @@ -1,6 +1,5 @@ using UnityEditor; - namespace VRM { [CustomEditor(typeof(VRMFirstPerson))] @@ -16,13 +15,19 @@ void OnSceneGUI() return; } + EditorGUI.BeginChangeCheck(); var worldOffset = head.localToWorldMatrix.MultiplyPoint(component.FirstPersonOffset); worldOffset = Handles.PositionHandle(worldOffset, head.rotation); Handles.Label(worldOffset, "FirstPersonOffset"); - component.FirstPersonOffset = head.worldToLocalMatrix.MultiplyPoint(worldOffset); + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(component, "Changed FirstPerson"); + + component.FirstPersonOffset = head.worldToLocalMatrix.MultiplyPoint(worldOffset); + } } } }