I want to create an enemy that spawn when the level starts and then increase over time. However, with the code I have right now the objects will never actually appear in my game. And if I move the Instantiate to if(spawnTime == 0) then two of each object will spawn (only 1 of each should).
var spawnTime : float = 0;
var timeIncrease : int = 0;
var Enemy: Transform;
var Enemy2:Transform;
function Update(){
if(spawnTime == 0){
timeIncrease = Time.time;
spawnTime = Time.time;
}
if(spawnTime == 10){
Instantiate(Enemy,transform.position,transform.rotation);
Instantiate(Enemy2,transform.position,transform.rotation);
spawnTime = 0;
}
if(timeIncrease == 30){
timeIncrease = 0;
spawnTime = -0.5;
}
}