using System; using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// 单例模块 /// public abstract class ModuleSingle : MonoBehaviour where T : ModuleSingle { /// 模块单例 public static T I => instance; /// 模块单例 protected static T instance; /// 核心模块 protected virtual ModuleCore ModuleCore => ModuleCore.I; /// 初始化 protected virtual void Awake() { if (instance != null) { Destroy(instance.gameObject); } instance = (T)this; } }