You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
namespace Game
|
|
{
|
|
public abstract class Singleton<T> where T : new()
|
|
{
|
|
private static T _instance;
|
|
public static T Instance
|
|
{
|
|
get
|
|
{
|
|
Create();
|
|
return _instance;
|
|
}
|
|
}
|
|
public static void Create()
|
|
{
|
|
_instance ??= new T();
|
|
}
|
|
|
|
}
|
|
} |