private void InvokeWillUnloadActions(List <string> sceneNames, SceneType sceneType)
        {
            foreach (string sceneName in sceneNames)
            {  // Announce scenes individually regardless of type
                OnWillUnloadScene?.Invoke(sceneName);
            }

            switch (sceneType)
            {
            case SceneType.Content:
                // Announce content as a set
                OnWillUnloadContent?.Invoke(sceneNames);
                break;

            case SceneType.Lighting:
                // We only handle lighting scenes one at a time
                Debug.Assert(sceneNames.Count == 1);
                OnWillUnloadLighting?.Invoke(sceneNames[0]);
                break;

            default:
                // Don't announce other types of scenes invidually
                break;
            }
        }
Пример #2
0
        private void InvokeWillUnloadActions(List <string> sceneNames, SceneType sceneType)
        {
            try
            {
                foreach (string sceneName in sceneNames)
                {  // Announce scenes individually regardless of type
                    OnWillUnloadScene?.Invoke(sceneName);
                }

                switch (sceneType)
                {
                case SceneType.Content:
                    // Announce content as a set
                    OnWillUnloadContent?.Invoke(sceneNames);
                    break;

                case SceneType.Lighting:
                    // We only handle lighting scenes one at a time
                    Debug.Assert(sceneNames.Count == 1);
                    OnWillUnloadLighting?.Invoke(sceneNames[0]);
                    break;

                default:
                    // Don't announce other types of scenes invidually
                    break;
                }
            }
            catch (Exception e)
            {
                Debug.LogError("Error when attempting to invoke will unload actions for " + string.Join(", ", sceneNames));
                Debug.LogException(e);
            }
        }