using System;
using UnityEngine;
namespace Framework.Services {
/// Kills scene-specific services when a new scene gets loaded
public class OnSceneLoadKiller : MonoBehaviour {
/// Called when Unity loads a different scene
///
/// According to the Unity wiki, OnLevelWasLoaded() can be called somewhere
/// inbetween the Awake() calls. That means we cannot use it because any Awake()
/// that was called before would have established a reference to the scene services
/// from the previous scene already. Thus we're relying on OnDisabled(), which
/// gets called before another scene is loaded.
///
public void OnDisabled() {
ServiceContainer.Kill(Scope.Scene);
}
}
} // namespace Framework.Services