private void Start() { // The pool is created pool = new UnityEngine.Pool(objectsToSpawn, 10, Vector3.zero, Quaternion.identity, false, randomInstantiationSequence); randomEssentials = new UnityEngine.RandomEssentials(); Debug.Log($"Press '{keyToSpawn}' to spawn a new object from the pool."); }
private IEnumerator coroutineHolder; // Keeps track of the coroutine private void Start() { // The pool is created pool = new UnityEngine.Pool(objectToSpawn, 100, false); randomEssentials = new UnityEngine.RandomEssentials(); Debug.Log($"Press '{keyToSpawn}' to spawn a new object from the pool."); //Assign the coroutine to the holder coroutineHolder = LoadingCoroutine(); //Run the coroutine StartCoroutine(coroutineHolder); }