using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// µ¥ÀýÀà /// namespace ZXK.GYJQR { public class Singleton : MonoBehaviour where T : MonoBehaviour { private static T _instance = null; protected Singleton() { } public static T Instance { get { return _instance; } } private void Awake() { if (_instance == null) { _instance = gameObject.GetComponent(); } else { Destroy(gameObject); } } } }