So I’ve been scripting a game that uses a Stat system.
I’ve been using mainly ints and a few floats for my numbers.
Recently, I had to add some more floats and change some ints to floats.
After fixing the compile errors associated with that mess, I found that I want to Truncate some of the floats. NOT ROUND, Truncate to 0 decimals. After an hour or 2 sifting through the forums for a truncate float method, I determined that I couldn’t find one for float, only doubles or by some casting to int method that just seemed like too much.
I decided to use the Mathf.Round()
method to create stand-in Truncate formula.
I was wondering if this was efficient enough to not have to do any double conversion or int casting and just use this for truncating floats from now on. Mathf.Round(N - 0.5f)
I don’t see any problem with it so far, But I haven’t used any absurdly finite floats or delved into the arbitrary math expressions realm with it yet.