using UnityEngine;
using System.Collections;
public class TSingleton<T> where T: new () {
private static T Singleton;
public static T GetInstance() {
if(Singleton == null){
Singleton = new T();
}
return Singleton;
}
}
原文:http://www.cnblogs.com/ZeroMurder/p/5236935.html