@@ -11,6 +11,7 @@ namespace Microsoft.MixedReality.Toolkit.Editor
11
11
public class MixedRealityToolkitInspector : UnityEditor . Editor
12
12
{
13
13
private SerializedProperty activeProfile ;
14
+ private UnityEditor . Editor activeProfileEditor ;
14
15
15
16
private void OnEnable ( )
16
17
{
@@ -33,7 +34,7 @@ public override void OnInspectorGUI()
33
34
{
34
35
if ( GUILayout . Button ( "Select Active Instance" ) )
35
36
{
36
- UnityEditor . Selection . activeGameObject = MixedRealityToolkit . Instance . gameObject ;
37
+ Selection . activeGameObject = MixedRealityToolkit . Instance . gameObject ;
37
38
}
38
39
39
40
if ( GUILayout . Button ( "Make this the Active Instance" ) )
@@ -46,7 +47,7 @@ public override void OnInspectorGUI()
46
47
47
48
serializedObject . Update ( ) ;
48
49
49
- // If not profile is assigned, then warn user
50
+ // If no profile is assigned, then warn user
50
51
if ( activeProfile . objectReferenceValue == null )
51
52
{
52
53
EditorGUILayout . HelpBox ( "MixedRealityToolkit cannot initialize unless an Active Profile is assigned!" , MessageType . Error ) ;
@@ -59,12 +60,17 @@ public override void OnInspectorGUI()
59
60
if ( changed )
60
61
{
61
62
MixedRealityToolkit . Instance . ResetConfiguration ( ( MixedRealityToolkitConfigurationProfile ) activeProfile . objectReferenceValue ) ;
63
+ activeProfileEditor = null ;
62
64
}
63
65
64
- if ( activeProfile . objectReferenceValue != null )
66
+ if ( activeProfile . objectReferenceValue != null && activeProfileEditor == null )
67
+ {
68
+ // For the configuration profile, show the default inspector GUI
69
+ activeProfileEditor = CreateEditor ( activeProfile . objectReferenceValue ) ;
70
+ }
71
+
72
+ if ( activeProfileEditor != null )
65
73
{
66
- // For configure, show the default inspector GUI
67
- UnityEditor . Editor activeProfileEditor = CreateEditor ( activeProfile . objectReferenceValue ) ;
68
74
activeProfileEditor . OnInspectorGUI ( ) ;
69
75
}
70
76
}
0 commit comments