Files
MuHua-Core/Packages/Tools/Runtime/Single/Single.cs
T
2025-03-04 16:19:52 +08:00

16 lines
402 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MuHua {
/// <summary>
/// 单例基类
/// </summary>
public class Single<T> where T : Single<T>, new() {
/// <summary> 模块单例 </summary>
public static T I => Instantiate();
protected static T instance;
protected static T Instantiate() => instance == null ? instance = new T() : instance;
}
}