in Assets/MRTK/Core/Inspectors/Profiles/MixedRealitySceneSystemProfileInspector.cs [86:231]
public override void OnInspectorGUI()
{
if (!MixedRealityToolkit.IsInitialized)
{
return;
}
if (!RenderProfileHeader(ProfileTitle, ProfileDescription, target))
{
return;
}
MixedRealityInspectorUtility.CheckMixedRealityConfigured(true);
serializedObject.Update();
MixedRealitySceneSystemProfile profile = (MixedRealitySceneSystemProfile)target;
if (!FindDefaultResources())
{
EditorGUILayout.HelpBox(defaultSceneContent, MessageType.Info);
}
RenderFoldout(ref showEditorProperties, "Editor Settings", () =>
{
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.PropertyField(editorManageBuildSettings);
EditorGUILayout.PropertyField(editorManageLoadedScenes);
EditorGUILayout.PropertyField(editorEnforceSceneOrder);
EditorGUILayout.PropertyField(editorEnforceLightingSceneTypes);
if (editorEnforceLightingSceneTypes.boolValue)
{
EditorGUILayout.Space();
EditorGUILayout.HelpBox("Below are the component types that will be allowed in lighting scenes. Types not found in this list will be moved to another scene.", MessageType.Info);
EditorGUIUtility.labelWidth = LightingSceneTypesLabelWidth;
EditorGUILayout.PropertyField(permittedLightingSceneComponentTypes, true);
EditorGUIUtility.labelWidth = 0;
}
}
}, ShowSceneSystem_Editor_PreferenceKey);
RenderFoldout(ref showManagerProperties, "Manager Scene Settings", () =>
{
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.HelpBox(managerSceneContent, MessageType.Info);
// Disable the tag field since we're drawing manager scenes
SceneInfoDrawer.DrawTagProperty = false;
EditorGUILayout.PropertyField(useManagerScene);
if (useManagerScene.boolValue && profile.ManagerScene.IsEmpty && !Application.isPlaying)
{
EditorGUILayout.HelpBox("You haven't created a manager scene yet. Click the button below to create one.", MessageType.Warning);
var buttonRect = EditorGUI.IndentedRect(EditorGUILayout.GetControlRect(System.Array.Empty<GUILayoutOption>()));
if (GUI.Button(buttonRect, "Create Manager Scene", EditorStyles.miniButton))
{
// Create a new manager scene and add it to build settings
SceneInfo newManagerScene = EditorSceneUtils.CreateAndSaveScene("ManagerScene");
SerializedObjectUtils.SetStructValue<SceneInfo>(managerScene, newManagerScene);
EditorSceneUtils.AddSceneToBuildSettings(newManagerScene, EditorBuildSettings.scenes, EditorSceneUtils.BuildIndexTarget.First);
}
EditorGUILayout.Space();
}
if (useManagerScene.boolValue)
{
EditorGUILayout.PropertyField(managerScene, includeChildren: true);
}
}
}, ShowSceneSystem_Manager_PreferenceKey);
RenderFoldout(ref showLightingProperties, "Lighting Scene Settings", () =>
{
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.HelpBox(lightingSceneContent, MessageType.Info);
EditorGUILayout.PropertyField(useLightingScene);
if (useLightingScene.boolValue && profile.NumLightingScenes < 1 && !Application.isPlaying)
{
EditorGUILayout.HelpBox("You haven't created a lighting scene yet. Click the button below to create one.", MessageType.Warning);
var buttonRect = EditorGUI.IndentedRect(EditorGUILayout.GetControlRect(System.Array.Empty<GUILayoutOption>()));
if (GUI.Button(buttonRect, "Create Lighting Scene", EditorStyles.miniButton))
{
// Create a new lighting scene and add it to build settings
SceneInfo newLightingScene = EditorSceneUtils.CreateAndSaveScene("LightingScene");
// Create an element in the array
lightingScenes.arraySize = 1;
serializedObject.ApplyModifiedProperties();
SerializedObjectUtils.SetStructValue<SceneInfo>(lightingScenes.GetArrayElementAtIndex(0), newLightingScene);
EditorSceneUtils.AddSceneToBuildSettings(newLightingScene, EditorBuildSettings.scenes, EditorSceneUtils.BuildIndexTarget.Last);
}
EditorGUILayout.Space();
}
if (useLightingScene.boolValue)
{
// Disable the tag field since we're drawing lighting scenes
SceneInfoDrawer.DrawTagProperty = false;
if (profile.NumLightingScenes > 0)
{
string[] lightingSceneNames = profile.LightingScenes.Select(l => l.Name).ToArray<string>();
defaultLightingSceneIndex.intValue = EditorGUILayout.Popup("Default Lighting Scene", defaultLightingSceneIndex.intValue, lightingSceneNames);
}
EditorGUILayout.PropertyField(lightingScenes, includeChildren: true);
EditorGUILayout.Space();
if (profile.NumLightingScenes > 0)
{
if (profile.EditorLightingCacheOutOfDate)
{
EditorGUILayout.HelpBox("Your cached lighting settings may be out of date. This could result in unexpected appearances at runtime.", MessageType.Warning);
}
if (InspectorUIUtility.RenderIndentedButton(new GUIContent("Update Cached Lighting Settings"), EditorStyles.miniButton))
{
profile.EditorLightingCacheUpdateRequested = true;
}
}
EditorGUILayout.Space();
}
}
}, ShowSceneSystem_Lighting_PreferenceKey);
RenderFoldout(ref showContentProperties, "Content Scene Settings", () =>
{
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.HelpBox(contentSceneContent, MessageType.Info);
// Enable the tag field since we're drawing content scenes
SceneInfoDrawer.DrawTagProperty = true;
EditorGUILayout.PropertyField(contentScenes, includeChildren: true);
}
}, ShowSceneSystem_Content_PreferenceKey);
serializedObject.ApplyModifiedProperties();
// Keep this inspector perpetually refreshed
EditorUtility.SetDirty(target);
}