using Sirenix.OdinInspector;
using UnityEngine;
namespace UnityTest.ZXL
{
///
/// 继承MonoBehavior的单例基类
///
///
public class BaseAutoMono : SerializedMonoBehaviour where T : MonoBehaviour
{
private static T instance;
public static T Instance()
{
if (instance == null)
{
GameObject go = new GameObject();
go.name = typeof(T).ToString();
DontDestroyOnLoad(go);
instance = go.AddComponent();
}
return instance;
}
}
}