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

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;

}
}

posted @ 2016-03-02 23:18  Fei非非  阅读(264)  评论(0编辑  收藏  举报