Hey There!
I’ve been enjoying the glitch garden part of the course so far. Completed most of the challenges without having to cheat.
Here’s my problem though: I want to add some time before the attackerspawners start spawning attackers. Currently it has a minimum and maximum time for spawn. I can technically delay the first spawn by making the minimum time large. However, if I want to then have fast spawns after the initial spawning delay is done, it falls apart.
Here are some of the ways I have tried and failed till now:
1> Inactivate the spawners in the editor to start with. Then have a separate script findobjectsoftype and activate them after a set delay. Or maybe instantiatefield an array of spawners that can be set gameObject.SetActive(true).
2> I tried making the bool spawn ‘false’ to initiate and then use update to check against a time.timesincelevelload timer to set it to true after some time. This however does not work. Setting the bool from true to false can stop the coroutene but it will not start if its false at start and then is turned on midway. I guess this is because the start is called in the beginning and if it doesnt start the coroutene, it is never called again.
Is there a way to call the coroutene from anywhere except start?
Or maybe there is a much simpler way to do this and I cannot think of it.
Thank you for your help in advance