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;
}
}
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;
}
}
转载于:https://www.cnblogs.com/ZeroMurder/p/5236935.html