_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Singleton.cs

21 lines
358 B
C#
Raw Normal View History

2024-11-15 23:31:54 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
public class Singleton<T> where T : new()
{
private static T ms_instance;
public static T Instance
{
get
{
if (ms_instance == null)
{
ms_instance = new T();
}
return ms_instance;
}
}
}