PopulatePool() public method

Populates the pool up to 'numberToPopulate' will not add to the pool past that count.
public PopulatePool ( int numberToPopulate ) : void
numberToPopulate int Amount to bring the pool up to.
return void
Exemplo n.º 1
0
        /// <summary>
        /// Populates the prefab's or GameObject's object pool up to the specified count.
        /// </summary>
        /// <param name="objToPopulate">The prefab or GameObject to populate.</param>
        /// <param name="amount">Number to populate with.</param>
        public static void PopulatePoolWithObj(GameObject objToPopulate, int amount)
        {
            PoolableGameObject poolable = objToPopulate.GetComponent <PoolableGameObject>();

            if (poolable == null)
            {
                Debug.LogErrorFormat(REQUIRES_COMP, objToPopulate.name, "PopulatePool");
                return;
            }

            poolable.PopulatePool(amount);
        }