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

public class Singelton<T> : MonoBehaviour where T: Singelton<T> {


    public static T instance { get; protected set; }


    void Awake()
    {
        if(instance != null && instance != this)
        {
            Destroy(this);
            throw new System.Exception("An instance of this already exists!");
        }
        else
        {
            instance = (T)this;
        }
    }
}
