mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
把代码核心逻辑移入热更工程,热更工程生成编译后可以直接Copy dll 和 mdb文件到UnityAsset目录下
把代码核心逻辑移入热更工程,热更工程生成编译后可以直接Copy dll 和 mdb文件到UnityAsset目录下
This commit is contained in:
28
TEngineHotUpdate/src/TEngineCore/Core/Singleton.cs
Normal file
28
TEngineHotUpdate/src/TEngineCore/Core/Singleton.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace TEngineCore
|
||||
{
|
||||
/// <summary>
|
||||
/// 通用单例,无需释放和销毁
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class Singleton<T> where T : new()
|
||||
{
|
||||
private static T _instance;
|
||||
|
||||
public static T Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new T();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static T Active()
|
||||
{
|
||||
return Instance;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user