using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MonoBaseMgr<T> : MonoBehaviour where T:MonoBehaviour
{
    private static T instance;
    public static T Getinstance() 
    {
        if (instance==null)
        {
            GameObject obj = new GameObject(typeof(T).ToString() + "Scripts");
            instance = obj.AddComponent<T>();
            DontDestroyOnLoad(obj);
        }
        return instance;
    }
    public static T GetInstance()
    {
        if (instance == null)
        {
            GameObject obj = new GameObject(typeof(T).ToString() + "Scripts");
            instance = obj.AddComponent<T>();
            DontDestroyOnLoad(obj);
        }
        return instance;
    }
    public static T Instance()
    {
        if (instance == null)
        {
            GameObject obj = new GameObject(typeof(T).ToString() + "Scripts");
            instance = obj.AddComponent<T>();
            DontDestroyOnLoad(obj);
        }
        return instance;
    }
}
