Day 5 — It’s been a while()
May 12, 2021
Objective: We now need to spawn enemies in our game efficiently.
How:
I’ve created a null object in my scene.
In it’s script, I’ve created a While() Loop within an IEnumerator and labeled this method ‘SpawnRoutine()’.
From here, we’ll instantiate the Enemy game object and tell it to spawn every 5 seconds randomly using yield return WaitForSeconds() & Random.Range().
This will create an effective system for spawning our enemy players as I’ve done so below: