Example #1
0
 private void InitializePool()
 {
     _pool         = new GameObject("Pool").AddComponent <LeanGameObjectPool>();
     _pool.Prefab  = GetPlayerControlledObjectPrefab();
     _pool.Preload = 500;
     _pool.PreloadAll();
 }
        /// <summary>
        /// Initializes ThrowablePool with the set numberOfThrowables
        /// </summary>
        public virtual void Initialize()
        {
            ThrowablePool = GetComponent <LeanGameObjectPool>();

            //the number of Objects to load into the pool
            ThrowablePool.Preload = numberOfThrowables;
            //the max number of Objects that the pool uses without recycling the last
            ThrowablePool.Capacity = numberOfThrowables;
            //Initializes the pool
            ThrowablePool.PreloadAll();

            //Loads throwables into DisplaySpots from the Pool
            LoadInitialThrowables();
        }