using System.Collections; using UnityEngine; namespace GFGGame.Launcher { public class SingletonMonoBase : MonoBehaviour where T : SingletonMonoBase { private static T _intance; public static T Instance { get { if (_intance == null) { GameObject gObj = GameObject.Find("SingletonObject"); if(gObj == null) { gObj = new GameObject("SingletonObject"); } _intance = gObj.GetComponent(); if(_intance == null) { _intance = gObj.AddComponent(); } } return _intance; } } } }