Fix ShowRealObjectsSwitch persistency

This commit is contained in:
Pascal Serrarens 2023-04-18 11:49:12 +02:00
parent e3ea1ce371
commit 927dfff7d1
2 changed files with 3 additions and 4 deletions

View File

@ -145,8 +145,6 @@ namespace Passer.Humanoid {
InteractionPointerButton(handTarget); InteractionPointerButton(handTarget);
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
//serializedObject.Update();
//serializedObject.ApplyModifiedProperties();
} }
public static HandTarget Inspector(HandTarget handTarget, string name) { public static HandTarget Inspector(HandTarget handTarget, string name) {
@ -439,8 +437,8 @@ namespace Passer.Humanoid {
if (showSettings) { if (showSettings) {
EditorGUI.indentLevel++; EditorGUI.indentLevel++;
// Cannot use serializedPropery because showRealObjects is a getter/setter SerializedProperty showObjectsProp = serializedObject.FindProperty("_showRealObjects");
bool showRealObjects = EditorGUILayout.Toggle("Show Real Objects", handTarget.showRealObjects); bool showRealObjects = EditorGUILayout.Toggle("Show Real Objects", showObjectsProp.boolValue);
if (showRealObjects != handTarget.showRealObjects) { if (showRealObjects != handTarget.showRealObjects) {
handTarget.showRealObjects = showRealObjects; handTarget.showRealObjects = showRealObjects;
handTarget.ShowSensors(showRealObjects, true); handTarget.ShowSensors(showRealObjects, true);

View File

@ -17,6 +17,7 @@ namespace Passer {
/// </summary> /// </summary>
public abstract class Target : MonoBehaviour { public abstract class Target : MonoBehaviour {
[SerializeField]
protected bool _showRealObjects = true; protected bool _showRealObjects = true;
/// <summary> /// <summary>
/// show the target meshes /// show the target meshes