MIF_E31221263/Assets/Scripts/Extra/Singleton.cs

14 lines
279 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Singleton<T> : MonoBehaviour where T : MonoBehaviour
{
public static T Instance { get; private set; }
protected virtual void Awake()
{
Instance = this as T;
}
}