Make an enemy instantied when time==0

I created this script:

var object:GameObject;
var spawn:GameObject;
var time:int=20;
var condition:boolean=false;
function TimePass(){
time--;
}
function Start(){
InvokeRepeating("TimePass", 1, 1);
if (time==0){
Instantiate(object);
}
}
function Update () {

}

function OnGUI() {
GUI.Label(Rect(10,10,100,100), ""+time);
}

It won’t work. How can i make an enemy instantied when time==0?

Your (time == 0) check is in the Start() code block, which only runs on Instantiation of the game object.

Move it to either Update, or to within the TimePass coroutine to make it function as intended