Timer in the fixedUpdate or Update in order to get stable timer ?

I need a Timer countdown. Where should I decrement this variable, on FixedUpdate or Update ? I know while training, Time Scale can be 20 times faster so I need to know what is the correct way to do this. Thanks

 if(Status == INFECTED)
        {
            if(recoverTime <= 0f)
            {
                Status = RECOVERED;
            }
            else
            {
                recoverTime -= Time.deltaTime;
            }
        }

Both Time.deltaTime and Time.fixedDeltaTime are affected by timeScale. Therefore you can decrement in Update (Time.deltaTime) as well as in FixedUpdate (Time.fixedDeltaTime). The agent loop runs on FixedUpdate steps, so FixedUpdate should the better choice if you need to sync value changes with agent steps.

2 Likes

Thanks