Hey, i am wondering that if there is any magic code or function that gets the delta of any floating value between last and current frame? Like a Mathf but doing a compare job between frames.What would be the ways of doing it?Any magic formula for this?I know that Time.deltaTime is irrelevant depending on the fps and gets always the same value.So could we do a math over it? If we multiply a floating value with Time.deltaTime would it give a kind of delta for us?
No magic formula, just manual tracking:
float lastFrameValue;
void Update() {
float deltaValue = currentFrameValue - lastFrameValue;
//other stuff
lastFrameValue = currentFrameValue;
}
Wash, rinse, repeat.
You could build a system that took an ID and current value pair, then returned the delta but it’s not part of the unity API and it would be slower to execute than using the pattern above.