一个小的单例类。再也不用担心继承类问题。

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;

}
}

你可能感兴趣的:(一个小的单例类。再也不用担心继承类问题。)