using System; using System.Reflection; using UnityEngine; public abstract class BaseManager where T : class { private static T instance; protected static readonly object lockObj = new object(); public static T Instance { get { if (instance == null) { lock (lockObj) { if (instance == null) { instance = (T)Activator.CreateInstance(typeof(T), true); } } } return instance; } } public virtual void Destroy() { instance = null; } }