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