Mathf.PingPong not working

I am trying to lerp a float between 0 and 1. I have read up about Mathf.PingPong on the unity docs, and it says my structure should look like this: float = Mathf.PingPong(Time.deltaTime, 1f). However the timer doesn’t even reach 0.02 before it resets. I have looked up, and it says that the time to lerp between 0 and 1 should be a self-incrementing value, which Time.deltaTime is, so i really don’t understand why it doesn’t work.

You’re mistaking usage of Time.deltaTime and Time.time in this situation.

Time.deltaTime is the time it took the last frame to render. (For example, if you had a constant 50fps, the value would be a constant 0.02). It doesn’t increment, because it’s not supposed to.

Time.time is the cumulative total gameplay time, effectively being itself + Time.deltaTime each frame.