Пример #1
0
 /// <summary>
 /// 获取实例
 /// </summary>
 /// <returns>实例</returns>
 public ILazy GetInstance()
 {
     if (pool.Any())
     {
         ILazy instance = pool.First();
         pool.Remove(instance);
         instance.SetActive(true);
         return(instance);
     }
     return(instantiate());
 }
Пример #2
0
 /// <summary>
 /// 返回实例
 /// </summary>
 /// <param name="instance">实例</param>
 public void ReturnInstance(ILazy instance)
 {
     instance.SetActive(false);
     pool.Add(instance);
 }