private static void Internal_NewSceneCreated(Scene scene, NewSceneSetup setup, NewSceneMode mode)
 {
     if (EditorSceneManager.newSceneCreated != null)
     {
         EditorSceneManager.newSceneCreated(scene, setup, mode);
     }
 }
 private static void Internal_NewSceneCreated(Scene scene, NewSceneSetup setup, NewSceneMode mode)
 {
     if (newSceneCreated != null)
     {
         newSceneCreated(scene, setup, mode);
     }
 }
Exemplo n.º 3
0
        public override void Action(int instanceId, string pathName, string resourceFile)
        {
            var o = CreateScript(pathName, resourceFile);

            AssetDatabase.SetLabels(o, new[] { "Layer" });


            var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName);
            var className = fileNameWithoutExtension.Replace(" ", string.Empty);

            className = className.Replace("Layer", "");

            // DataFramework.nextLayerPath = pathName;
            AssetDatabase.ImportAsset(pathName, ImportAssetOptions.ForceUpdate);
            ProjectWindowUtil.ShowCreatedAsset(o);
            AssetDatabase.Refresh();

            ProcEditorSceneObserve.name = $"Assets/Scenes/Scene {className}.unity";
            // ProcEditorSceneObserve.script = o as MonoScript;

            EditorSceneManager.newSceneCreated += ProcEditorSceneObserve.SceneCreating;
            const NewSceneSetup setup = NewSceneSetup.EmptyScene;
            var scene = EditorSceneManager.NewScene(setup);

            EditorSceneManager.SaveScene(scene, ProcEditorSceneObserve.name);
        }
Exemplo n.º 4
0
 private static void EditorSceneManagerOnNewSceneCreated(Scene scene, NewSceneSetup setup, NewSceneMode mode)
 {
     SetupCameras();
     SetupLights();
     // SetupUI();
     SetupWorld();
 }
Exemplo n.º 5
0
 void OnNewSceneCreated(Scene scene, NewSceneSetup setup, NewSceneMode mode)
 {
     if (!currentItem.isMainStage)
     {
         GoToMainStage(false, Analytics.ChangeType.GoToMainViaNewSceneCreated);
     }
 }
Exemplo n.º 6
0
 private static void ResetSceneInfo(Scene scene, NewSceneSetup setup, NewSceneMode mode)
 {
     currentScene           = scene;
     currentSceneName       = " < Untitled > ";
     currentSceneFolderPath = "";
     SetDefaultExportPath();
 }
Exemplo n.º 7
0
    private static void SceneCreated(Scene scene, NewSceneSetup setup, NewSceneMode mode)
    {
        var camGO   = Camera.main.transform;
        var lightGO = GameObject.Find("Directional Light").transform;

        var setupFolder = new GameObject("[SETUP]").transform;
        var lights      = new GameObject("Lights").transform;

        lights.parent  = setupFolder;
        lightGO.parent = lights;

        var cam = new GameObject("Cameras").transform;

        cam.parent   = setupFolder;
        camGO.parent = cam;

        var world = new GameObject("[WORLD]").transform;

        new GameObject("Static").transform.parent  = world;
        new GameObject("Dynamic").transform.parent = world;

        new GameObject("[UI]");

        Debug.Log("NEW SCENE CREATED");
    }
Exemplo n.º 8
0
    private static void NewSceneCreated(Scene scene, NewSceneSetup newSceneSetup, NewSceneMode newSceneMode)
    {
        if (Simulator.Editor.Build.Running)
        {
            return;
        }

        var objects = scene.GetRootGameObjects();

        for (int index = objects.Length - 1; index >= 0; --index)
        {
            Object.DestroyImmediate(objects[index]);
        }
        Debug.Log($"Removed {objects.Length} Unity Editor default new scene objects that will conflict with LGSVL Simulator");

        var tempGO = new GameObject("MapHolder");

        tempGO.transform.position = Vector3.zero;
        tempGO.transform.rotation = Quaternion.identity;
        var MapHolder    = tempGO.AddComponent <MapHolder>();
        var trafficLanes = new GameObject("TrafficLanes").transform;

        trafficLanes.SetParent(tempGO.transform);
        MapHolder.trafficLanesHolder = trafficLanes;
        var intersections = new GameObject("Intersections").transform;

        intersections.SetParent(tempGO.transform);
        MapHolder.intersectionsHolder = intersections;
        var origin = new GameObject("MapOrigin").AddComponent <MapOrigin>();
        var spawn  = new GameObject("SpawnInfo").AddComponent <SpawnInfo>();

        Debug.Log($"Added required MapHolder, MapOrigin and SpawnInfo objects for LGSVL Simulation.  Please set MapOrigin and spawn location");
    }
        /// <summary>
        /// <para>Create a new Scene.</para>
        /// </summary>
        /// <param name="setup">Whether the new Scene should use the default set of GameObjects.</param>
        /// <param name="mode">Whether to keep existing Scenes open.</param>
        /// <returns>
        /// <para>A reference to the new Scene.</para>
        /// </returns>
        public static Scene NewScene(NewSceneSetup setup, [DefaultValue("NewSceneMode.Single")] NewSceneMode mode)
        {
            Scene scene;

            INTERNAL_CALL_NewScene(setup, mode, out scene);
            return(scene);
        }
Exemplo n.º 10
0
    public static void SceneCreating(Scene scene, NewSceneSetup setup, NewSceneMode mode)
    {
        if (BuildPipeline.isBuildingPlayer)
        {
            return;
        }
        if (Camera.main == null)
        {
            return;
        }
        var camGO = Camera.main.gameObject;
        var light = GameObject.Find("Directional Light");

        if (light != null)
        {
            GameObject.DestroyImmediate(light.gameObject);
        }

        GameObject.DestroyImmediate(camGO);
        new GameObject("[SETUP]");
        var s = new GameObject("[SCENE]");
        var d = new GameObject("Dynamic");

        d.transform.parent = s.transform;
        Debug.Log("New scene created!");
    }
Exemplo n.º 11
0
        public static Scene NewScene(NewSceneSetup setup, [DefaultValue("NewSceneMode.Single")] NewSceneMode mode)
        {
            Scene result;

            EditorSceneManager.INTERNAL_CALL_NewScene(setup, mode, out result);
            return(result);
        }
Exemplo n.º 12
0
 private static void OnNewSceneCreated(Scene scene, NewSceneSetup setup, NewSceneMode mode)
 {
     if (mode == NewSceneMode.Single && !_autoGenerateLighting)
     {
         EditorHelper.ChangeAutoGenerateLightingState(false);
     }
 }
Exemplo n.º 13
0
    public override void Action(int instanceId, string pathName, string resourceFile)
    {
        NewSceneSetup setup = NewSceneSetup.EmptyScene;
        var           scene = EditorSceneManager.NewScene(setup);

        EditorSceneManager.SaveScene(scene, pathName);
    }
 public static Scene NewScene(NewSceneSetup setup)
 {
   NewSceneMode mode = NewSceneMode.Single;
   Scene scene;
   EditorSceneManager.INTERNAL_CALL_NewScene(setup, mode, out scene);
   return scene;
 }
Exemplo n.º 15
0
        public static Scene newScene(NewSceneSetup setup)
        {
            Scene scene = EditorSceneManager.NewScene(setup, NewSceneMode.Additive);

            EditorSceneManager.SetActiveScene(scene);
            return(scene);
        }
Exemplo n.º 16
0
 void OnNewSceneCreated(Scene scene, NewSceneSetup setup, NewSceneMode mode)
 {
     if (!(currentStage is MainStage))
     {
         GoToMainStage(Analytics.ChangeType.GoToMainViaNewSceneCreated);
     }
 }
        public static Scene NewScene(NewSceneSetup setup)
        {
            Scene result;

            result = NewScene(setup, NewSceneMode.Single);
            return(result);
        }
Exemplo n.º 18
0
        public static void SceneCreated(Scene scene, NewSceneSetup setup, NewSceneMode mode)
        {
            GameObject SetupGO = new GameObject("[SETUP]");
            GameObject WorldGO = new GameObject("[WORLD]");
            GameObject UI_GO   = new GameObject("[UI]");

            GameObject CamsGO    = new GameObject("Cameras");
            GameObject LightsGO  = new GameObject("Lights");
            GameObject StarterGO = new GameObject("Starter");
            GameObject StorageGO = new GameObject("Storage");

            GameObject StaticWorldGO  = new GameObject("Static");
            GameObject DynamicWorldGO = new GameObject("Dynamic");

            GameObject InterfaceGO = new GameObject("Interface");

            CamsGO.transform.SetParent(SetupGO.transform);
            LightsGO.transform.SetParent(SetupGO.transform);
            StarterGO.transform.SetParent(SetupGO.transform);
            StorageGO.transform.SetParent(SetupGO.transform);

            StaticWorldGO.transform.SetParent(WorldGO.transform);
            DynamicWorldGO.transform.SetParent(WorldGO.transform);

            InterfaceGO.transform.SetParent(UI_GO.transform);
        }
Exemplo n.º 19
0
 private void OnNewScene(Scene scene, NewSceneSetup setup, NewSceneMode mode)
 {
     if (BuildPipeline.isBuildingPlayer == false)
     {
         Close();
     }
 }
Exemplo n.º 20
0
        public static Scene NewScene(NewSceneSetup setup)
        {
            NewSceneMode mode = NewSceneMode.Single;
            Scene        result;

            EditorSceneManager.INTERNAL_CALL_NewScene(setup, mode, out result);
            return(result);
        }
Exemplo n.º 21
0
        public static Scene NewScene(NewSceneSetup setup)
        {
            Scene        scene;
            NewSceneMode single = NewSceneMode.Single;

            INTERNAL_CALL_NewScene(setup, single, out scene);
            return(scene);
        }
 protected virtual void SettingsTabGUI()
 {
     this.newSceneSetup   = (NewSceneSetup)EditorGUILayout.EnumPopup("New Scene Setup", this.newSceneSetup);
     this.newSceneMode    = (NewSceneMode)EditorGUILayout.EnumPopup("New Scene Mode", this.newSceneMode);
     this.openSceneMode   = (OpenSceneMode)EditorGUILayout.EnumPopup("Open Scene Mode", this.openSceneMode);
     this.showPath        = EditorGUILayout.Toggle("Show Path", this.showPath);
     this.showAddToBuild  = EditorGUILayout.Toggle("Show Add To Build", this.showAddToBuild);
     this.askBeforeDelete = EditorGUILayout.Toggle("Ask Before Delete", this.askBeforeDelete);
 }
Exemplo n.º 23
0
 private static void EditorSceneManagerOnNewSceneCreated(Scene scene, NewSceneSetup setup, NewSceneMode mode)
 {
     if (mode == NewSceneMode.Single)
     {
         SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes();
     }
     //need to clear scene on new scene since all new scenes use the same GUID
     SceneVisibilityState.ClearScene(scene);
 }
Exemplo n.º 24
0
        private static void SetUpScene(Scene scene, NewSceneSetup setup, NewSceneMode mode)
        {
            // destroy new scene default camera
            Object.DestroyImmediate(UnityEngine.Camera.main.gameObject);

            GameObject go = UnityEditor.PrefabUtility.InstantiatePrefab((GameObject)UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/_Development/ToolAssets/DefaultScene.prefab", typeof(GameObject))) as GameObject;

            UnityEditor.PrefabUtility.UnpackPrefabInstance(go, UnityEditor.PrefabUnpackMode.OutermostRoot, UnityEditor.InteractionMode.AutomatedAction);
            go.transform.DetachChildren();
            Object.DestroyImmediate(go);
        }
Exemplo n.º 25
0
 static void OnNewSceneCreated(Scene scene, NewSceneSetup setup, NewSceneMode mode)
 {
     if (!s_CurrentInMemorySceneState.valid || mode != NewSceneMode.Single)
     {
         return;
     }
     if (s_CurrentInMemorySceneState.guid != scene.guid)
     {
         ClearInMemorySceneState();
     }
 }
Exemplo n.º 26
0
 static void NewSceneCreated(Scene scene, NewSceneSetup setup, NewSceneMode mode)
 {
     if (!InHDRP() || HDProjectSettings.defaultScenePrefab == null)
     {
         return; // do not interfere outside of hdrp
     }
     if (setup == NewSceneSetup.DefaultGameObjects)
     {
         ClearScene(scene);
         FillScene(scene);
     }
 }
        public bool InitializeMerge(GameObject prefab)
        {
            if (!EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
            {
                return(false);
            }

            isMergingScene           = false;
            MergeAction.inMergePhase = false;

            ObjectDictionaries.Clear();

            //checkout "their" version
            GetTheirVersionOf(AssetDatabase.GetAssetOrScenePath(prefab));
            AssetDatabase.Refresh();

            ourPrefab = prefab;

            //Open a new Scene that will only display the prefab
            previouslyOpenedScene = SceneManager.GetActiveScene().path;

            var sceneSetup = new NewSceneSetup();

            EditorSceneManager.NewScene(sceneSetup);

            //make the new scene empty
            Object.DestroyImmediate(Camera.main.gameObject);

            //instantiate our object in order to view it while merging
            ourPrefabInstance = PrefabUtility.InstantiatePrefab(prefab) as GameObject;

            //find all of "our" objects in the prefab
            var ourObjects = GetAllObjects(prefab);

            theirPrefab           = AssetDatabase.LoadAssetAtPath(theirFilename, typeof(GameObject)) as GameObject;
            theirPrefab.hideFlags = HideFlags.HideAndDontSave;
            var theirObjects = GetAllObjects(theirPrefab);

            //create list of differences that have to be merged
            BuildAllMergeActions(ourObjects, theirObjects);

            if (allMergeActions.Count == 0)
            {
                AssetDatabase.DeleteAsset(theirFilename);
                OpenPreviousScene();
                window.ShowNotification(new GUIContent("No conflict found for this prefab."));
                return(false);
            }
            MergeAction.inMergePhase = true;
            ourPrefabInstance.Highlight();
            return(true);
        }
Exemplo n.º 28
0
 protected virtual void OnEnable()
 {
     this.newSceneSetup = ( NewSceneSetup )EditorPrefs.GetInt(
         "SceneManager.newSceneSetup",
         ( int )NewSceneSetup.DefaultGameObjects);
     this.newSceneMode  = ( NewSceneMode )EditorPrefs.GetInt("SceneManager.newSceneMode", ( int )NewSceneMode.Single);
     this.openSceneMode = ( OpenSceneMode )EditorPrefs.GetInt(
         "SceneManager.openSceneMode",
         ( int )OpenSceneMode.Single);
     this.showPath        = EditorPrefs.GetBool("SceneManager.showPath", false);
     this.showAddToBuild  = EditorPrefs.GetBool("SceneManager.showAddToBuild", true);
     this.askBeforeDelete = EditorPrefs.GetBool("SceneManager.askBeforeDelete", true);
 }
        private static void NewSceneCreated(Scene scene, NewSceneSetup setup, NewSceneMode mode)
        {
            switch (setup)
            {
            // Ignore the check when the scene is explicitly empty.
            // This includes empty scenes in playmode tests.
            case NewSceneSetup.EmptyScene:
                break;

            case NewSceneSetup.DefaultGameObjects:
                CheckMixedRealityToolkitScene();
                break;
            }
        }
Exemplo n.º 30
0
        private static void SetupNewScene(Scene scene, NewSceneSetup setup, NewSceneMode mode)
        {
            if (setup == NewSceneSetup.EmptyScene)
            {
                return;
            }

            var mainCamera       = Camera.main?.transform;
            var directionalLight = GameObject.Find("Directional Light")?.transform;

            var ui             = new GameObject("UI").transform;
            var logic          = new GameObject("Logic").transform;
            var debug          = new GameObject("Debug").transform;
            var singletons     = new GameObject("Singletons").transform;
            var environment    = new GameObject("Environment").transform;
            var geo            = new GameObject("Geo").transform;
            var staticObjects  = new GameObject("Static").transform;
            var dynamicObjects = new GameObject("Dynamic").transform;
            var runtime        = new GameObject("Runtime").transform;
            var lighting       = new GameObject("Lights").transform;
            var cameras        = new GameObject("Cameras").transform;
            var vfx            = new GameObject("VFX").transform;
            var audio          = new GameObject("Audios").transform;
            var sfx            = new GameObject("SFX").transform;
            var music          = new GameObject("Music").transform;
            var entites        = new GameObject("Entites").transform;

            lighting.SetParent(environment.transform);
            mainCamera?.SetParent(cameras.transform);

            debug.SetParent(logic);

            cameras.SetParent(environment.transform);
            directionalLight?.SetParent(lighting.transform);

            geo.SetParent(environment);
            singletons.SetParent(logic);

            staticObjects.SetParent(geo);
            dynamicObjects.SetParent(geo);

            vfx.SetParent(environment);

            audio.SetParent(environment);
            sfx.SetParent(audio);
            music.SetParent(audio);

            staticObjects.gameObject.isStatic = true;
            CreateSceneLogicPrefabs(logic);
        }
Exemplo n.º 31
0
 protected virtual void SettingsTabGUI()
 {
     this.scenesSource = (ScenesSource)EditorGUILayout.EnumPopup("Scenes Source", this.scenesSource);
     if (this.scenesSource == ScenesSource.Manual)
     {
         this.searchFolder = EditorGUILayout.TextField("Search Folder", this.searchFolder);
     }
     this.newSceneSetup   = (NewSceneSetup)EditorGUILayout.EnumPopup("New Scene Setup", this.newSceneSetup);
     this.newSceneMode    = (NewSceneMode)EditorGUILayout.EnumPopup("New Scene Mode", this.newSceneMode);
     this.openSceneMode   = (OpenSceneMode)EditorGUILayout.EnumPopup("Open Scene Mode", this.openSceneMode);
     this.showPath        = EditorGUILayout.Toggle("Show Path", this.showPath);
     this.showAddToBuild  = EditorGUILayout.Toggle("Show Add To Build", this.showAddToBuild);
     this.askBeforeDelete = EditorGUILayout.Toggle("Ask Before Delete", this.askBeforeDelete);
 }
Exemplo n.º 32
0
 public static Scene NewScene(NewSceneSetup setup)
 {
     Scene scene;
     NewSceneMode single = NewSceneMode.Single;
     INTERNAL_CALL_NewScene(setup, single, out scene);
     return scene;
 }
 /// <summary>
 ///   <para>Create a new scene.</para>
 /// </summary>
 /// <param name="setup">Allows you to select whether or not the default set of Game Objects should be added to the new scene. See SceneManagement.NewSceneSetup for more information about the options.</param>
 /// <param name="mode">Allows you to select how to open the new scene, and whether to keep existing scenes in the Hierarchy. See SceneManagement.NewSceneMode for more information about the options.</param>
 public static Scene NewScene(NewSceneSetup setup, [DefaultValue("NewSceneMode.Single")] NewSceneMode mode)
 {
   Scene scene;
   EditorSceneManager.INTERNAL_CALL_NewScene(setup, mode, out scene);
   return scene;
 }
 private static extern void INTERNAL_CALL_NewScene(NewSceneSetup setup, NewSceneMode mode, out Scene value);