I need help with my spawning system(SOLVED)
I am trying to make a spawning system based on time and exact positions, i made something but the problem that i have is that when i break 2 or more game objects at the same time, or even in quick succesion there is a spot that remains empty.
The spawner that i am trying to make works like this, there is a game object at a set location for example vector3(-1,0.25,0) and when i click that game object i would like it to be destroyed and after a set ammount of seconds for example 0.5f and spawn at the same location another random game object .
EDIT: I managed to fix the problem using the queue method , if anybody is intrested i could post an example of my code.
Answer by MrReynevan2 · Jul 31, 2016 at 12:10 PM
You could use a coroutine for it, I guess. Something along the lines of:
IEnumerator DestroyEnemy(GameObject enemy)
{
var pos = enemy.pos;
Destroy(enemy);
yield return new WaitForSeconds(0.5f);
SpawnRandom(pos);
}
You can call it like so:
StartCoroutine(DestroyEnemy(e));