Files
ZHGD_Web/Assets/Script/Tool/Singleton.cs
2025-07-13 23:16:20 +08:00

21 lines
314 B
C#

using UnityEngine;
public class Singleton<T> : MonoBehaviour where T : MonoBehaviour
{
private static T _inst;
public static T Inst
{
get { return _inst; }
}
private void Awake()
{
_inst = this as T;
}
private void OnDisable()
{
_inst = null;
}
}