Exemple #1
0
 /// <summary>
 /// Create a new pool from code
 /// </summary>
 /// <param name="poolingObject"></param>
 /// <param name="groupName"></param>
 /// <param name="startingSize"></param>
 /// <param name="autoResize"></param>
 /// <param name="maxSize"></param>
 /// <param name="autoCreate"></param>
 /// <returns></returns>
 public static PoolingList CreatePoolingList(GameObject poolingObject, string groupName, int startingSize, bool autoResize = true, int maxSize = 0, bool fill = true)
 {
     if (!poolingLists.ContainsKey(groupName))
     {
         GameObject  poolingListObject = new GameObject(POOLING_GAMEOBJECT_PREFIX + groupName);
         PoolingList poolingList       = poolingListObject.AddComponent <PoolingList>();
         poolingList.SetupPool(poolingObject, groupName, startingSize, maxSize, fill, autoResize);
         return(poolingList);
     }
     else
     {
         Debug.LogWarning("You are trying to create a pool that already exists, we returned the existing list. PoolingList name: " + groupName);
         return(poolingLists[groupName]);
     }
 }
Exemple #2
0
 public static void AddPoolingList(string listName, PoolingList list)
 {
     poolingLists.Add(listName, list);
     list.gameObject.transform.SetParent(PoolingSceneContainer.transform);
     list.gameObject.name = POOLING_GAMEOBJECT_PREFIX + listName;
 }