Something wrong with TimedeltaTime

I changed the command several times but nothing happens.

  function Update(){
        if (bar == false){
        currlife = 100;
    }
    
    
else
    currlife -= 1.0 * Time.deltaTime;
}

Tried:
currlife -= Time.deltaTime * 0.1;

currlife -= Time.deltaTime;

You might want to be sure that currlife is a float when you declare it:

curlife : float = 100.0;

There is nothing wrong with Time.deltaTime. Check your stuff again.

Did you try using it outside of else? The problem amybe bar never becomes true.

RenatoB, I tested your script and it really runs fast like a crazy horse! The problem is the type of the currlife var: if you don’t specify the type, javascript will do it for you, right or wrong! That’s a golden rule in unity’s javascript: always define the type of any var. When javascript finds an untyped variable, it must decide at runtime which’s the type of its contents; it wastes CPU time and may generate errors. I fixed your script and there it goes:

var bar: boolean;
var maxlife: float = 100;
var currlife: float = 100;

function Start(){
	bar = false;
}

function Update(){
    if (bar == false){
        currlife = 100;
    } else {
        currlife -= 1.0 * Time.deltaTime;
	}
}

function OnTriggerEnter(){
    bar = true;
}

function OnTriggerExit(){
    bar = false;
}