Can't round to nearest decimal?

RandomGameDev 3 years ago updated 3 years ago 3

Trying to get two floats, compare them and if equal then do action.

however if I compare the raw floats it never reads true as the decimals are too long
if I use any of the THREE round math nodes then they only round to the nearest INT and so I get TOO many true reads instead of just one like I need.

Is there not a way to round to decimal yet? If so is it on the roadmap and I missed it? Thanks!

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

Compare should work nice can you share your code?


If I understand correctly, you want to round a float to a single decimal place?

You can add the System.Math class to your custom type options and use Math.Round to achieve that: 


thanks for reminding me about adding custom types. I will try this out today. In the mean time I got around the issue by multiplying my value by 100, getting the round of that and then dividing by 100. Then I turned that into a super state. Your way sounds easier haha.