123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using UnityEngine;
- public abstract class WindowSingleton<T> : MonoBehaviour where T : MonoBehaviour
- {
-
- static T instance;
- protected bool _isInit = false;
- public static T Instance
- {
- get
- {
- if (instance == null)
- {
- instance =(T)FindObjectOfType<T>();
- }
- return instance;
- }
- }
- void Start()
- {
-
-
- this.OnStart();
- }
- protected virtual void OnStart()
- {
- }
- public virtual void UpdateData()
- {
- }
- public virtual void OnEnable()
- {
- }
- }
|