I have set a cube in my scene and I want it so every 15 seconds, my enemy spawns and then resets the timer so it will spawn again. If anyone knows how to make this happen please help me.
You can use a Coroutine or the update-method!
Coroutine:
void Start(){
StartCoroutine(EnemySpawner());
}
IEnumerator(){
while(true){
//SpawnEnemy
yield return new WaitForSeconds(15);
}
}
Update method:
float timer = 0f;
void Update(){
if(timer <= 15f){
timer += Time.deltaTime;
}
else{
timer = 0;
//Spawn Enemy
}
}