From 927dfff7d18651a5414713a6d6794aeadd0b47a7 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Tue, 18 Apr 2023 11:49:12 +0200 Subject: [PATCH] Fix ShowRealObjectsSwitch persistency --- Editor/HumanoidControl/Targets/HandTarget_Editor.cs | 6 ++---- Runtime/HumanoidControl/Scripts/Targets/Target.cs | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Editor/HumanoidControl/Targets/HandTarget_Editor.cs b/Editor/HumanoidControl/Targets/HandTarget_Editor.cs index 8a37d7c..045fdc9 100644 --- a/Editor/HumanoidControl/Targets/HandTarget_Editor.cs +++ b/Editor/HumanoidControl/Targets/HandTarget_Editor.cs @@ -145,8 +145,6 @@ namespace Passer.Humanoid { InteractionPointerButton(handTarget); serializedObject.ApplyModifiedProperties(); - //serializedObject.Update(); - //serializedObject.ApplyModifiedProperties(); } public static HandTarget Inspector(HandTarget handTarget, string name) { @@ -439,8 +437,8 @@ namespace Passer.Humanoid { if (showSettings) { EditorGUI.indentLevel++; - // Cannot use serializedPropery because showRealObjects is a getter/setter - bool showRealObjects = EditorGUILayout.Toggle("Show Real Objects", handTarget.showRealObjects); + SerializedProperty showObjectsProp = serializedObject.FindProperty("_showRealObjects"); + bool showRealObjects = EditorGUILayout.Toggle("Show Real Objects", showObjectsProp.boolValue); if (showRealObjects != handTarget.showRealObjects) { handTarget.showRealObjects = showRealObjects; handTarget.ShowSensors(showRealObjects, true); diff --git a/Runtime/HumanoidControl/Scripts/Targets/Target.cs b/Runtime/HumanoidControl/Scripts/Targets/Target.cs index fe2b0ca..752c9a4 100644 --- a/Runtime/HumanoidControl/Scripts/Targets/Target.cs +++ b/Runtime/HumanoidControl/Scripts/Targets/Target.cs @@ -17,6 +17,7 @@ namespace Passer { /// public abstract class Target : MonoBehaviour { + [SerializeField] protected bool _showRealObjects = true; /// /// show the target meshes