using UnityEngine; namespace Blue { public class SingletonMonobehaviour : AbstractController where T:SingletonMonobehaviour { private static T _instance; public static T Instance { get => _instance; } public virtual void OnAwake() { } private void Awake() { if (_instance == null) { _instance = this.GetComponent(); _instance.OnAwake(); DontDestroyOnLoad(_instance); } else { Destroy(gameObject); } } } }