public override void OnInspectorGUI() { HMRConfigurationManager configManager = (HMRConfigurationManager)target; configManager.validateConfigurationsLabeled(); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(serializedObject.FindProperty("_configuration"), new GUIContent("Selected Configuration")); serializedObject.ApplyModifiedProperties(); if (EditorGUI.EndChangeCheck()) { applySelectedConfiguration(); } EditorGUILayout.Space(); if (GUILayout.Button("Reapply Selected Configuration")) { applySelectedConfiguration(); } EditorGUILayout.Space(); int selectedConfigurationIndex = serializedObject.FindProperty("_configuration").enumValueIndex; HMRConfigurationManager.HMRConfiguration selectedConfiguration = (HMRConfigurationManager.HMRConfiguration)selectedConfigurationIndex; if (selectedConfiguration == HMRConfigurationManager.HMRConfiguration.VR_WORLD_VR_HANDS) { EditorGUILayout.LabelField("Hands to use for VR Hands (References Hand Controller)", EditorStyles.boldLabel); EditorGUI.BeginChangeCheck(); configManager._handController.leftGraphicsModel = (HandModel)EditorGUILayout.ObjectField("Left Hand Graphics Model", configManager._handController.leftGraphicsModel, typeof(HandModel), false); configManager._handController.rightGraphicsModel = (HandModel)EditorGUILayout.ObjectField("Right Hand Graphics Model", configManager._handController.rightGraphicsModel, typeof(HandModel), false); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(configManager._handController.leftGraphicsModel); EditorUtility.SetDirty(configManager._handController.rightGraphicsModel); } } }
public void OnEnable() { _manager = target as HMRConfigurationManager; SerializedProperty configArray = serializedObject.FindProperty("_headMountedConfigurations"); _configNames = new string[configArray.arraySize]; for (int i = 0; i < configArray.arraySize; i++) { _configNames[i] = configArray.GetArrayElementAtIndex(i).FindPropertyRelative("_configurationName").stringValue; } }