// Copyright (c) Pixel Crushers. All rights reserved. using UnityEngine; namespace PixelCrushers { /// /// Service to notify subscribers when a scene is being unloaded. /// public static class SceneNotifier { public delegate void UnloadSceneDelegate(int sceneIndex); /// /// Invoked by NotifyWillUnloadScene(sceneIndex), which should be called /// before unloading a scene. /// public static event UnloadSceneDelegate willUnloadScene = delegate { }; /// /// Notifies all subscribers that the scene with the specified index will be unloaded. /// /// Scene index in build settings. public static void NotifyWillUnloadScene(int sceneIndex) { willUnloadScene(sceneIndex); } } }