Regen HP Should I use Time.deltaTime vs Time.time vs Time.realtimeSinceStart ?

I want to make timer for regen hp charactor.

Should I use Time.deltaTime or Time.time or Time.realtimeSinceStart ?

I want to best fair for all player. I want to it is not depend on spec mobile.

Should It put in Update() or FixedUpdate() ?

I would use Time.deltaTime in a normal Update method!

I think frame rate it depend on spec mobile.

That’s the point of Time.deltaTime, you multiply something by it, and it gives you the same value over time regardless of the frame rate.

health += 5.0f * Time.deltaTime; //after one second, their health has gone up by 5 points, regardless of frame rate

Time.deltaTime makes it so the code is not frame dependent (or rather far less dependent).

deltaTime is also subject to Time.timeScale so if your game has any slow-mo, fast forwarding, or pause then it would be affected by this. You typically want to be using this.

unscaledDeltaTime is similar to deltaTime except it doesn’t read the timeScale, thus it will still play normally even if the game is paused (typically used for GUI animations in a pause menu).

Time.realtimeSinceStartUp measures the time since startup from that exact moment you call it. more often than not you don’t want to use this. but it could be useful as a stopwatch for testing a function’s performance.

Time.time measures realTimeSinceStartUp at the beginning of the frame and the reuses that time for the whole frame (regardless of how long that frame is). this is preferable if you want to sync objects with a parametric function. it can however be undefined in Awake calls so be careful about using it in them.