21 lines
340 B
C#
21 lines
340 B
C#
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
|
|||
|
|
public class Singleton<T> where T:new()
|
|||
|
|
{
|
|||
|
|
static T instance;
|
|||
|
|
|
|||
|
|
public static T Insatnce
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
if(instance==null)
|
|||
|
|
{
|
|||
|
|
instance = new T();
|
|||
|
|
}
|
|||
|
|
return instance;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|