public static T GetInstance <T>(Type type = null) where T : IPool { if (type == null) { type = typeof(T); } if (mPoolDic.ContainsKey(type) == false) { mPoolDic.Add(type, new Queue <IPool>()); } IPool o = null; if (mPoolDic[type].Count > 0) { o = mPoolDic[type].Dequeue(); } else { o = (IPool)Activator.CreateInstance(type); } o.OnCreate(); o.isPool = false; return((T)o); }