27 lines
495 B
C#
27 lines
495 B
C#
using UnityEngine;
|
|
|
|
namespace ZXL.Manager
|
|
{
|
|
public class Manager<T> : MonoBehaviour
|
|
{
|
|
private static T _instance;
|
|
|
|
public static T Instance => _instance;
|
|
|
|
private void Awake()
|
|
{
|
|
if (_instance != null)
|
|
{
|
|
Destroy(this.gameObject);
|
|
return;
|
|
}
|
|
|
|
_instance = this.GetComponent<T>();
|
|
OnAwake();
|
|
}
|
|
|
|
public virtual void OnAwake()
|
|
{
|
|
}
|
|
}
|
|
} |