using UnityEngine; namespace AibisDream { public class Singleton : MonoBehaviour where T : Singleton { public static T Instance { get; private set; } protected virtual void Awake() { if (Instance != null) { Destroy(gameObject); } else { Instance = (T)this; } } public static bool IsInitialized => Instance != null; protected virtual void OnDestroy() { if (Instance == this) { Instance = null; } } } }