in my player script i have a bunch of stats, and they all regen a small unique amount every time i call the ‘regen’ function i made. I put the regen function in the Update() of the script. My question is: this is a bad idea right? doesnt that mean players with a faster framerate will regen faster? if so, should i use a kind of timing system like:
if(Time.time > nextRegen)
{// i use .1 so that the health smoothly ticks up, instead of large ticks every second.
nextRegen = Time.time + .1;
}
and as a side question to that piece of code: if i was to use this time system, is there any downsides to letting the nextRegen variable just run off for hours of gameplay, getting larger and larger? is there ever a point where it breaks, or does the variable just loop back to 0. if it loops back to 0 will i stop regenerating? because the Time.time would be larger than 0 by that point unless the time rolls back to 0 too.but they might not roll back to 0 at the same value causing me to regen too fast or not at all… so confused.
sorry for a bunch of questions in one post, but im fairly new to unity and I havent worked with it enough to understand its variables and Time.time quite yet.