I have an energy variable (float) that has a value of 100f.
I want to keep reducing this variable until it reaches 0f.
This this the script that I use:
energy = Mathf.Max(0f, energy - energyless);
I set the value of energyless to 0.001f and run the script.
From debug.log I can see the energy variable keep getting lower, but it never reached zero.
It seems to stop reducing at 0.001. Why is that?