in Assets/MixedRealityToolkit/Inspectors/Profiles/MixedRealityToolkitConfigurationProfileInspector.cs [124:318]
public override void OnInspectorGUI()
{
serializedObject.Update();
RenderMixedRealityToolkitLogo();
if (!MixedRealityToolkit.IsInitialized)
{
EditorGUILayout.HelpBox("Unable to find Mixed Reality Toolkit!", MessageType.Error);
return;
}
if (!configurationProfile.IsCustomProfile)
{
EditorGUILayout.HelpBox("The Mixed Reality Toolkit's core SDK profiles can be used to get up and running quickly.\n\n" +
"You can use the default profiles provided, copy and customize the default profiles, or create your own.", MessageType.Warning);
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("Copy & Customize"))
{
CreateCopyProfileValues();
}
if (GUILayout.Button("Create new profiles"))
{
ScriptableObject profile = CreateInstance(nameof(MixedRealityToolkitConfigurationProfile));
var newProfile = profile.CreateAsset("Assets/MixedRealityToolkit.Generated/CustomProfiles") as MixedRealityToolkitConfigurationProfile;
MixedRealityToolkit.Instance.ActiveProfile = newProfile;
Selection.activeObject = newProfile;
}
EditorGUILayout.EndHorizontal();
}
// We don't call the CheckLock method so won't get a duplicate message.
if (MixedRealityPreferences.LockProfiles && !((BaseMixedRealityProfile)target).IsCustomProfile)
{
GUI.enabled = false;
}
var previousLabelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 160f;
EditorGUI.BeginChangeCheck();
bool changed = false;
// Experience configuration
EditorGUILayout.Space();
ExperienceScale experienceScale = (ExperienceScale)targetExperienceScale.intValue;
showExperienceProperties = EditorGUILayout.Foldout(showExperienceProperties, "Experience Settings", true);
if (showExperienceProperties)
{
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.PropertyField(targetExperienceScale, TargetScaleContent);
string scaleDescription = string.Empty;
switch (experienceScale)
{
case ExperienceScale.OrientationOnly:
scaleDescription = "The user is stationary. Position data does not change.";
break;
case ExperienceScale.Seated:
scaleDescription = "The user is stationary and seated. The origin of the world is at a neutral head-level position.";
break;
case ExperienceScale.Standing:
scaleDescription = "The user is stationary and standing. The origin of the world is on the floor, facing forward.";
break;
case ExperienceScale.Room:
scaleDescription = "The user is free to move about the room. The origin of the world is on the floor, facing forward. Boundaries are available.";
break;
case ExperienceScale.World:
scaleDescription = "The user is free to move about the world. Relies upon knowledge of the environment (Spatial Anchors and Spatial Mapping).";
break;
}
if (scaleDescription != string.Empty)
{
GUILayout.Space(6f);
EditorGUILayout.HelpBox(scaleDescription, MessageType.Info);
}
}
}
// Camera Profile configuration
EditorGUILayout.Space();
showCameraProperties = EditorGUILayout.Foldout(showCameraProperties, "Camera Settings", true);
if (showCameraProperties)
{
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.PropertyField(enableCameraProfile);
changed |= RenderProfile(cameraProfile);
}
}
// Input System configuration
EditorGUILayout.Space();
showInputProperties = EditorGUILayout.Foldout(showInputProperties, "Input System Settings", true);
if (showInputProperties)
{
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.PropertyField(enableInputSystem);
EditorGUILayout.PropertyField(inputSystemType);
changed |= RenderProfile(inputSystemProfile);
}
}
// Boundary System configuration
EditorGUILayout.Space();
showBoundaryProperties = EditorGUILayout.Foldout(showBoundaryProperties, "Boundary System Settings", true);
if (showBoundaryProperties)
{
using (new EditorGUI.IndentLevelScope())
{
if (experienceScale != ExperienceScale.Room)
{
// Alert the user if the experience scale does not support boundary features.
GUILayout.Space(6f);
EditorGUILayout.HelpBox("Boundaries are only supported in Room scale experiences.", MessageType.Warning);
GUILayout.Space(6f);
}
EditorGUILayout.PropertyField(enableBoundarySystem);
EditorGUILayout.PropertyField(boundarySystemType);
changed |= RenderProfile(boundaryVisualizationProfile);
}
}
// Teleport System configuration
EditorGUILayout.Space();
showTeleportProperties = EditorGUILayout.Foldout(showTeleportProperties, "Teleport System Settings", true);
if (showTeleportProperties)
{
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.PropertyField(enableTeleportSystem);
EditorGUILayout.PropertyField(teleportSystemType);
}
}
// Spatial Awareness System configuration
EditorGUILayout.Space();
showSpatialAwarenessProperties = EditorGUILayout.Foldout(showSpatialAwarenessProperties, "Spatial Awareness System Settings", true);
if (showSpatialAwarenessProperties)
{
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.PropertyField(enableSpatialAwarenessSystem);
EditorGUILayout.PropertyField(spatialAwarenessSystemType);
EditorGUILayout.HelpBox("Spatial Awareness settings are configured per observer.", MessageType.Info);
changed |= RenderProfile(spatialAwarenessSystemProfile);
}
}
// Diagnostics System configuration
EditorGUILayout.Space();
showDiagnosticProperties = EditorGUILayout.Foldout(showDiagnosticProperties, "Diagnostics System Settings", true);
if (showDiagnosticProperties)
{
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.HelpBox("It is recommended to enable the Diagnostics system during development. Be sure to disable prior to building your shipping product.", MessageType.Warning);
EditorGUILayout.PropertyField(enableDiagnosticsSystem);
EditorGUILayout.PropertyField(diagnosticsSystemType);
changed |= RenderProfile(diagnosticsSystemProfile);
}
}
// Registered Services configuration
EditorGUILayout.Space();
showRegisteredServiceProperties = EditorGUILayout.Foldout(showRegisteredServiceProperties, "Extension Services", true);
if (showRegisteredServiceProperties)
{
using (new EditorGUI.IndentLevelScope())
{
changed |= RenderProfile(registeredServiceProvidersProfile);
}
}
if (!changed)
{
changed |= EditorGUI.EndChangeCheck();
}
EditorGUIUtility.labelWidth = previousLabelWidth;
serializedObject.ApplyModifiedProperties();
if (changed)
{
EditorApplication.delayCall += () => MixedRealityToolkit.Instance.ResetConfiguration(configurationProfile);
}
}