mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
GameScripts
GameScripts
This commit is contained in:
23
Assets/GameScripts/HotFix/GameBase/Singleton.cs
Normal file
23
Assets/GameScripts/HotFix/GameBase/Singleton.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using TEngine;
|
||||
|
||||
namespace GameBase
|
||||
{
|
||||
public class Singleton<T> where T:new()
|
||||
{
|
||||
private static T _instance;
|
||||
public static T Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null == _instance)
|
||||
{
|
||||
_instance = new T();
|
||||
Log.Assert(_instance != null);
|
||||
}
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user