I’m having an issue in the project that I’m working on.
I have some resource values that are slowly ticking up as you’re gathering them.
I’m using a double, but when displaying it in game I’m showing them without decimals using .ToString(“0”)
For some reason when running the game the display shows the full number (1,2,3,4,etc.) before it’s actually gathered - my estimate is that it rounds up, once it reached X.5.
I first realized this when implementing a resource that accumulate much slower than the normal resources (a 0.1/sec rate).
It feels really clunky that you have to wait about 5 seconds, before being able to buy the object you want to buy, when the display tells you that you’re able to.
What do the 1.9f do?
What would happen if i wrote 0.9f or 2.9f instead?
Is there a “better” or more beginner friendly place to look up c#/unity functions other than the Unity API?
I’m often times having a hard time understanding the API description.
Just implemented your suggestion and it works! Thank you
Did not set the float (in my case a double) to 1.9f; but just 0; but I don’t know if that was just to exemplify on your behalf cause it seems to work
Yes, that 1.9f was just an arbitrary value I put into the float to show how the rounding would work in that trivial example. It has no impact on the functioning of the Floor function.