using System;
namespace XRTool.Util
{
///
/// 基本的单例,不依附Unity
///
///
public abstract class Singleton where T :class, new()
{
private static T instance;
private static readonly object syslock = new object();
public static T Instance
{
get
{
//线程安全锁
if (instance == null)
{
lock (syslock)
{
if (instance == null)
{
instance = new T();
}
}
}
return instance;
}
}
}
}