using UnityEngine;


public abstract class WindowSingleton<T> : MonoBehaviour where T : MonoBehaviour
{
    public string data;
    static T instance;
    protected bool _isInit = false;
    public static T Instance
    {
        get
        {
            if (instance == null)
            {
                instance =(T)FindObjectOfType<T>();
            }
            return instance;
        }

    }

    void Start()
    {
        //if (global) DontDestroyOnLoad(this.gameObject);
        //Debug.Log(this.gameObject.name);
        this.OnStart();
    }

    protected virtual void OnStart()
    {

    }

    public virtual void UpdateData(string data)
    {
        this.data = data;
    }

    public virtual void OnEnable()
    {

    }
}