Hi Guys,
Quick question about coroutines here; I’m setting up spawn system that utilizes a Coroutine and I’m running into some problems while trying to use several (yield return new) statements. Basically, the idea is to have a coroutine with two timers running inside. One is controlling the rate at which my while loop executes (and instantiates some game objects) and the other controls the length at which the coroutine runs for. At this point I’m not sure if I can reach the desired effect using just a Coroutine or if I should just write a custom function that gets called from Update.
Thanks for looking!
private IEnumerator Spawn(ObjectType type, float setLength, float spawnRate) {
if (type == ObjectType.B) {
while (true) {
for (int i = 0; i < points.Count; i++) {
Instantiate(ball, points_.transform.position, points*.transform.rotation);*_
* }*
* yield return new WaitForSeconds(spawnRate);*
* }*
* }*
* yield return new WaitForSeconds(setLength);*
* Debug.Log(“Reached the end”);*
* }*