Optimal way for making enemies respawn
Hi everyone!
As for now, my enemies are created from invisible spawners. After the enemy is created, the spawner is destroyed. This means that an enemy can only be spawned once in a level.
My thought about creating respawning enemies goes like this:
Spread a unique ID to the spawner when it's created. When the player is within a set distance to the spawner, the spawner creates the enemy and then transfers it's ID to the spawned enemy.
However, what I don't really know how to do is the next step, which is limiting the spawner from creating an enemy if the spawners enemy already exists and has the same ID as the spawner.
Does anyone know how to solve this? Any best practice for this perhaps?