Beispiel #1
0
    static void SceneLoaded(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
    {
        BuildTargetGroup[] targetGroups = { BuildTargetGroup.Android, BuildTargetGroup.iOS, BuildTargetGroup.Standalone };

        foreach (BuildTargetGroup grp in targetGroups)
        {
            string defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(grp);
            if (scene.name.Contains("Server"))
            {
                if (defines != "")
                {
                    defines += ";";
                }
                defines += "SCENE_HOST";
            }
            else
            {
                if (defines.Contains("SCENE_HOST"))
                {
                    defines = defines.Replace(";SCENE_HOST", "");
                    defines = defines.Replace("SCENE_HOST", "");
                }
            }
            PlayerSettings.SetScriptingDefineSymbolsForGroup(grp, defines);
        }
    }
 //Callback when scene is opened
 static void OnSceneOpened(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
 {
     if (debug)
     {
         UnityEngine.Debug.Log("Callback open call");
     }
     UpdateDatabase(ActionType: "Open scene", Modality: "", Target: scene.name);
 }
Beispiel #3
0
 static void SceneOpenedCallback(Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
 {
     // refresh window when scene is opened to display content images correctly
     if (null != VRCSdkControlPanel.window)
     {
         VRCSdkControlPanel.window.Reset();
     }
 }
    static void CheckForSceneScript(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
    {
        GameObject go = GameObject.Find(scene.name);

        if (!scene.name.Contains(MISSION_SCENE_NAME))
        {
            if (go == null)
            {
                new GameObject(scene.name);
            }
        }

        return;
    }
Beispiel #5
0
    static void OnSceneOpened(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
    {
        CheckForSceneScript(scene, mode);

        string path = Application.dataPath + SCENE_ROOT_PATH;

        if (!Directory.Exists(path))
        {
            Debug.LogWarning("Can`t find Assets/Scene. Make sure already execute Assets/Framework/Initialize Framework Directory");
            Debug.LogWarning("Cuureent setted path: " + path);
            return;
        }


        string [] files = Directory.GetFiles(path, "*.unity", SearchOption.AllDirectories);


        EditorBuildSettingsScene [] scenes = new EditorBuildSettingsScene [files.Length];

        for (int i = 0; i < files.Length; ++i)
        {
            string scenePath = files [i];

            scenePath = scenePath.Replace("\\", "/");
            scenePath = scenePath.Substring(scenePath.IndexOf("Assets" + SCENE_ROOT_PATH));

            scenes [i]         = new EditorBuildSettingsScene(scenePath, true);
            scenes [i].enabled = false;

            if (files [i].Contains(SceneLookup.GetString(SceneLookupEnum.World_GameRoot)))               // == GameRoot
            {
                scenes [i].enabled = true;
            }
        }

        EditorBuildSettings.scenes = scenes;
        if (scenes.Length == 0)
        {
            Debug.LogWarning("Generated new build setting contain 0 scene, please check path of scene root");
        }
        Debug.Log("Generated new build setting for scenes");
        for (int i = 0; i < scenes.Length; ++i)
        {
            Debug.Log("No." + i + "-- Scene Path: " + scenes [i].path);
        }
    }
Beispiel #6
0
        private static void SceneOpened(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
        {
            if (!(scene.path.Contains("TobiiPro") && scene.path.Contains("Examples")))
            {
                return;
            }

            if (_vrScenes.Contains(scene.name))
            {
                if (!VRSupported)
                {
                    if (EditorUtility.DisplayDialog(
                            title: _dialogTitle,
                            message: "This demo scene requires enabling Unity virtual reality support.",
                            ok: "Enable VR support",
                            cancel: "Cancel"))
                    {
                        VRSupported = true;
                    }
                }

#if UNITY_2018_1_OR_NEWER
                // Redundant callback removal to avoid lingering attached methods.
                EditorApplication.update -= CheckPackageInstallation;
                EditorApplication.update -= CheckListCompletion;
                EditorApplication.update -= CheckIfWeHaveOpenVRPackage;
                if (VRSupported)
                {
                    EditorApplication.update += CheckIfWeHaveOpenVRPackage;
                }
#endif
            }
            else if (_screenBasedScenes.Contains(scene.name) && VRSupported)
            {
                if (EditorUtility.DisplayDialog(
                        title: _dialogTitle,
                        message: "This demo scene should not have Unity virtual reality support enabled.",
                        ok: "Disable VR support",
                        cancel: "Cancel"))
                {
                    VRSupported = false;
                }
            }
        }
        //static void SceneOpeningCallback(string path, UnityEditor.SceneManagement.OpenSceneMode mode)
        static void SceneOpenedCallback(Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
        {
            // Only even attempt mirror check if we are looking at a sample scene.
            if (!scene.name.Contains("Example") && !scene.name.Contains("Sample"))
            {
                return;
            }

            //if (_mode == UnityEditor.SceneManagement.OpenSceneMode.)
            // get root objects in scene
            List <GameObject> rootObjects = new List <GameObject>();

            //Scene scene = SceneManager.GetActiveScene();
            scene.GetRootGameObjects(rootObjects);

            /// Need to make sure all NetIds have been converted before converting NM
            if (!mirrorNetIdAlreadyAddedToResources)
            {
                Debug.Log("Mirror NetId being added to all resources that have UNET NetId");
                AddMirrorNetIdToResources();
                mirrorNetIdAlreadyAddedToResources = true;
            }

            // iterate root objects and do something
            for (int i = 0; i < rootObjects.Count; ++i)
            {
                GameObject go = rootObjects[i];
                if (go)
                {
                    var mc = go.GetComponent <MirrorCheck>();
                    {
                        if (mc)
                        {
                            mc.AddMirrorNetManager();
                        }
                    }
                }
            }
        }
        static void OnSceneOpenedCallback(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
        {
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                return;
            }

            // return until hot reload is enabled
            return;

            // Update scene name.
            sSceneName    = UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().name;
            sIsSceneDirty = false;

            sPrefabMap.Clear();
            sMeshMap.Clear();
            sMaterialMap.Clear();
            sShaderMap.Clear();
            sTextureMap.Clear();

            CollectSceneInfo(sPrefabMap, sMeshMap, sMaterialMap, sShaderMap, sTextureMap);
        }
Beispiel #9
0
    static void CheckForSceneScript(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
    {
        //GameObject[] gameObjects= scene.GetRootGameObjects();
        //bool isExistSceneRootGameobject = false;
        //foreach (GameObject go in gameObjects)
        //{
        //    if(go.name.IndexOf( scene.name) != -1)
        //    {
        //        isExistSceneRootGameobject = true;
        //    }
        //}

        GameObject go = GameObject.Find(scene.name);

        if (go == null)
        {
            new GameObject(scene.name);
        }


        return;
    }
 private void OnSceneOpening(string path, UnityEditor.SceneManagement.OpenSceneMode mode)
 {
     // when reopen scene/new scene in Editor Not-Playing Mode
     m_isOpeningScene = true;
     //Debug.LogError($"OnSceneOpening {path} {mode}");
 }
Beispiel #11
0
    // _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_

    #region SCENE EDITOR EVENTS DELEGATES
    static void SceneOpenedCallback(Scene _scene, UnityEditor.SceneManagement.OpenSceneMode _mode)
    {
        log("SCENE LOADED");
        LoadOrCreate();
    }
Beispiel #12
0
 static void SceneOpenedCallback(Scene _scene,
                                 UnityEditor.SceneManagement.OpenSceneMode _mode)
 {
 }
Beispiel #13
0
        private static void OnSceneOpenedCallback(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
        {
            if (mode != UnityEditor.SceneManagement.OpenSceneMode.Single)
            {
                return;
            }

            if (string.IsNullOrEmpty(scene.name))
            {
                return;
            }

            CurrentOpenedSceneName = scene.name;
        }
 private static void OnSceneOpening(string path, UnityEditor.SceneManagement.OpenSceneMode mode)
 {
     CommonHybridUtils.ClearSpriteRendererGroup();
 }
 static void onSceneOpen(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
 {
     TerminalDialog.CloseWindow();
 }
Beispiel #16
0
 private void SceneOpened(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
 {
     isDirty = true;
     Update();
 }
Beispiel #17
0
 private static void SceneOpenedCallback(Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
 {
     PeekLogic.UpdateSceneGameObjectFromSceneLoad(scene);
 }
Beispiel #18
0
        // When scene is opened, go over all objects of same type and assign ids if missing.
        static void OnEditorSceneManagerSceneOpened(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
        {
            var mapHolder = UnityEngine.Object.FindObjectOfType <MapHolder>();

            if (mapHolder == null)
            {
                return;
            }

            // If there is no ID set, set autogenerated ones.
            foreach (var sign in mapHolder.transform.GetComponentsInChildren <MapLane>())
            {
                if (string.IsNullOrEmpty(sign.id))
                {
                    sign.id = IdGenerator.AutogenerateNextId <MapLane>(idPrefix);
                }
            }
        }
 static void OnSceneOpened(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
 {
     CheckForSceneScript(scene, mode);
     UpdateSceneBuildSetting();
 }
 private static void SceneOpenedCallback(Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
 {
     _gameObjectsList.Clear();
     AppendAllTransformInSceneToList(scene);
     OnSceneLoaded?.Invoke(_gameObjectsList);
 }
 /** オープン。
  *
  *      a_assets_path_with_extention	: 「Assets」からの相対バス。拡張子付き。
  *      a_mode							: モード。
  *
  */
 public static UnityEngine.SceneManagement.Scene Open(string a_assets_path_with_extention, UnityEditor.SceneManagement.OpenSceneMode a_mode)
 {
     return(UnityEditor.SceneManagement.EditorSceneManager.OpenScene("Assets/" + a_assets_path_with_extention, a_mode));
 }
 static void OnSceneLoaded(Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
 {
     EditorUtil.DisableHasTransformed();
 }
Beispiel #23
0
        static void OnEditorSceneManagerSceneOpened(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
        {
            var mapHolder = UnityEngine.Object.FindObjectOfType <MapHolder>();

            if (mapHolder == null)
            {
                return;
            }

            var existingSignals = new List <MapSignal>(mapHolder.transform.GetComponentsInChildren <MapSignal>());
            int curMaxId        = 0;

            for (int i = 0; i < existingSignals.Count; i++)
            {
                var signal = existingSignals[i];
                int curId  = GetNumber(signal.id);
                if (curId > curMaxId)
                {
                    curMaxId = curId;
                }
                if (string.IsNullOrEmpty(signal.UID)) // if there is no UID set, set a random one
                {
                    signal.UID = Guid.NewGuid().ToString();
                }
            }
            MaxId = curMaxId;
        }
 private void OnSceneOpened(Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
 {
     // when reopen scene/new scene in Editor Not-Playing Mode
     m_isOpeningScene = false;
     //Debug.LogError($"OnSceneOpened {scene.name} {mode}");
 }