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

public abstract class MonoBehaviourSingleton<T> : MonoBehaviour where T : MonoBehaviourSingleton<T>
{
	private static T _instance = null;

	public static T instance
	{
		get { return _instance; }
	}

	protected virtual void Awake()
	{
        if (_instance == null)
        {
            _instance = this as T;
            Debug.Log("Singleton create: " + this.GetType().ToString() + " id=" + gameObject.GetInstanceID());
        }
        else
        {
            Debug.Log("Singleton ERROR:" + this.GetType().ToString() + " id=" + gameObject.GetInstanceID());
        }
	}
}
