public override void OnInspectorGUI() { AmsMultiSceneSetup target = (AmsMultiSceneSetup)this.target; // Help give us better hints at what the different SceneSetup modes refer to... if (target.sceneSetupMode == AmsMultiSceneSetup.SceneSetupManagement.Automatic) { bool isActiveScene = (SceneManager.GetActiveScene() == target.gameObject.scene); if (isActiveScene) { EditorGUILayout.HelpBox("Scene Setup is automatically generated and saved with the scene based on the hierarchy.", MessageType.Info); } else { EditorGUILayout.HelpBox("Scene Setup will not be updated or saved unless this Scene is set as Active", MessageType.Warning); } if (target.GetSceneSetup().Count < 1) { DrawPropertiesExcluding(serializedObject, "m_Script", "_sceneSetup"); EditorGUILayout.HelpBox("This scene was never saved as the Active Scene.\nTherefore this Scene will not auto-load other scenes.", MessageType.Info); } else { DrawPropertiesExcluding(serializedObject, "m_Script"); } } else if (target.sceneSetupMode == AmsMultiSceneSetup.SceneSetupManagement.Manual) { EditorGUILayout.HelpBox("Scene Setup will not changed unless you modify it manually (or change Scene Setup Mode).", MessageType.Info); DrawPropertiesExcluding(serializedObject, "m_Script"); } else { EditorGUILayout.HelpBox("Scene Setup will not be saved", MessageType.Warning); DrawPropertiesExcluding(serializedObject, "m_Script", "_sceneSetup"); } EditorGUILayout.HelpBox("Note: This behaviour is always required for cross-scene referencing to work.", MessageType.Info); // Since we're not using SerializedProperties, we need to update the SerializedObject ourselves. serializedObject.ApplyModifiedProperties(); serializedObject.Update(); // If anything changed, we should resetup the SceneSetup and repaint the hierarchy if (GUI.changed) { AmsMultiSceneSetup.OnSceneSaving(target.gameObject.scene, target.scenePath); EditorApplication.RepaintHierarchyWindow(); } }
private static void GetCommonParameters( ref Scene activeScene, ref AmsMultiSceneSetup activeSceneSetup, List<AmsMultiSceneSetup.SceneEntry> bakedScenes ) { // We can only execute this when building the player. Otherwise we expect entries to already be in the scene. if ( !BuildPipeline.isBuildingPlayer ) return; // Get the SceneSetup for the Active Scene. activeScene = EditorSceneManager.GetActiveScene(); activeSceneSetup = GameObjectEx.GetSceneSingleton<AmsMultiSceneSetup>( activeScene, false ); if ( !activeSceneSetup ) return; var scenesInSetup = activeSceneSetup.GetSceneSetup(); foreach( var entry in scenesInSetup ) { bool bShouldBake = entry.loadMethod == AmsMultiSceneSetup.LoadMethod.Baked; if ( bShouldBake ) bakedScenes.Add( entry ); } }