AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
AttachToControllerEditor.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using UnityEditor;
5 using UnityEngine;
6 
7 namespace HoloToolkit.Unity.InputModule
8 {
9  [CustomEditor(typeof(AttachToController))]
11  {
12  private SerializedProperty positionOffsetProperty;
13  private SerializedProperty rotationOffsetProperty;
14  private SerializedProperty scaleOffsetProperty;
15  private SerializedProperty setScaleOnAttachProperty;
16  private SerializedProperty setChildrenInactiveWhenDetachedProperty;
17 
18  protected override void OnEnable()
19  {
20  base.OnEnable();
21 
22  positionOffsetProperty = serializedObject.FindProperty("PositionOffset");
23  rotationOffsetProperty = serializedObject.FindProperty("RotationOffset");
24  scaleOffsetProperty = serializedObject.FindProperty("ScaleOffset");
25  setScaleOnAttachProperty = serializedObject.FindProperty("SetScaleOnAttach");
26  setChildrenInactiveWhenDetachedProperty = serializedObject.FindProperty("SetChildrenInactiveWhenDetached");
27  }
28 
29  public override void OnInspectorGUI()
30  {
31  base.OnInspectorGUI();
32  serializedObject.Update();
33 
34  EditorGUILayout.Space();
35  EditorGUILayout.LabelField("Attachment Options", new GUIStyle("Label") { fontStyle = FontStyle.Bold });
36  EditorGUILayout.Space();
37  EditorGUI.indentLevel++;
38 
39  EditorGUILayout.PropertyField(positionOffsetProperty);
40  EditorGUILayout.PropertyField(rotationOffsetProperty);
41  EditorGUILayout.PropertyField(scaleOffsetProperty);
42  EditorGUILayout.PropertyField(setScaleOnAttachProperty);
43  EditorGUILayout.PropertyField(setChildrenInactiveWhenDetachedProperty);
44 
45  EditorGUI.indentLevel--;
46  serializedObject.ApplyModifiedProperties();
47  }
48  }
49 }