// get T from pool public static T GenObj(GameObject objPrefab = null) { // 设置prefab s_objPrefab = objPrefab; if (s_transRecycleParent == null || s_objPrefab == null) { Develop.LogErrorF("not init pool : {0}", typeof(T)); return(default(T)); } if (s_pool == null) { s_pool = new UnityEngine.UI.ObjectPool <T>( (t) => { t.__Init(); }, (t) => { t.__Release(); } ); } return((T)s_pool.Get()); }
//开始收集 public static GPerformance Start(string strTag) { if (!IfPerformance) { if (m_tmp == null) { m_tmp = new GPerformance(); } return(m_tmp); } if (s_pool == null) { s_pool = new UnityEngine.UI.ObjectPool <GPerformance>((obj) => { }, (obj) => { }); } GPerformance pfm = (GPerformance)s_pool.Get(); pfm.m_timeStart = DateTime.Now; pfm.m_strTag = strTag; return(pfm); }