16 lines
447 B
C#
16 lines
447 B
C#
/// <summary>
|
|
/// this class is not a MonoBehaviour. Its purpose is to make it possible to have global classes that will not be in the scene.
|
|
/// </summary>
|
|
/// <typeparam name="T"></typeparam>
|
|
public class Singleton<T> where T : Singleton<T>, new()
|
|
{
|
|
private static T _instance;
|
|
public static T Instance
|
|
{
|
|
get
|
|
{
|
|
if (_instance == null) _instance = new T();
|
|
return _instance;
|
|
}
|
|
}
|
|
} |