public PlayModeStripper(StrippingType setStrippingType, PlayModeStrippingMethod setStrippingMethod)
        {
                        #if DEV_MODE && DEBUG_RESET_STATE
            Debug.Log("PlayModeStripper(" + setStrippingType + ", " + setStrippingMethod + ").");
                        #endif

            playModeStripping       = setStrippingType;
            playModeStrippingMethod = setStrippingMethod;

            SceneManager.sceneLoaded               += OnSceneLoaded;
            SceneManager.sceneUnloaded             += OnSceneUnloaded;
            EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
        }
Beispiel #2
0
        public PlayModeStripper(StrippingType setStrippingType, PlayModeStrippingMethod setStrippingMethod)
        {
            playModeStripping       = setStrippingType;
            playModeStrippingMethod = setStrippingMethod;

            if (playModeStripping == StrippingType.None)
            {
                return;
            }

            SceneManager.sceneLoaded               += OnSceneLoaded;
            SceneManager.sceneUnloaded             += OnSceneUnloaded;
            EditorApplication.playModeStateChanged += OnPlayModeStateChanged;

            for (int s = 0, scount = SceneManager.sceneCount; s < scount; s++)
            {
                var scene = SceneManager.GetSceneAt(s);
                if (scene.isLoaded && playModeStrippingHandledForScenes.Add(scene))
                {
                    HierarchyFolderUtility.ApplyStrippingType(scene, playModeStripping);
                }
            }
        }