using UnityEngine;
/// <summary>
/// As opposed to the Singleton class that you can find at http://www.bivis.com.br/2016/05/04/unity-reusable-singleton-tutorial/, 
/// which (1) doesn't need to be attached to any GameObject in the scene, and (2) persists across scenes,
/// this Simpleton class is meant to be "attached" to one GameObject within the scene and be globally accessible within that scene only.
/// </summary>
public abstract class Simpleton<T> : MonoBehaviour where T : MonoBehaviour
{
    private static T instance;
    public static T Instance {
        get {
            if (instance == null) {
                instance = FindObjectOfType<T>();
            }
            return instance;
        }
    }
}