1
This commit is contained in:
17
unity/Assets/Script/Tools/Utils/Singleton.cs
Normal file
17
unity/Assets/Script/Tools/Utils/Singleton.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Singleton<T> where T : new()
|
||||
{
|
||||
static T instance;
|
||||
public static T Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
return instance = new T();
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user