Destory when far away and spawn when close

Hi! im making a survival game and i wanna spawn enemies when i get close to a place. And when i get far away they get destroyed, also random spawntime on them when im close.

Kinda like GTA respawn system.

How is this possible? thanks for help!!

you could probably get this working with a large trigger collider attached to the player. Then the “spawners” would need a triggerEnter/Exit function to turn them on/off. Enemies could have a triggerExit function which destroys them if the player moves away.

http://unity3d.com/learn/tutorials/modules/beginner/physics/colliders-as-triggers?playlist=17120