- Home /
whats a mathf.round
i keep seeing this code on scripts it says like mathf.round and im just wondering wat it is and is there any documentation on it thx
Answer by Statement · Mar 29, 2011 at 12:55 PM
Yes. Always check the scripting reference first when looking for documentation on Unity3D. It even has a search field where you can search for "Mathf.Round".
I would suggest using the local version of the docs. Loads up instantly, no waiting between searches etc. $$anonymous$$y local address is like below...
file:///C:/Program%20Files%20%28x86%29/Unity/Editor/Data/Documentation/Documentation/ScriptReference/index.html
Sure, you can use the local copy but the online version is always up-to-date and i never use the internal search. I just use google to search ;) much faster.
Yeah, the search on that site is incredibly slow. I also google for "unity3d reference $$anonymous$$athf.Round" rather than going to the refs.
@Sarper: You could just click Help/Scripting Reference.
Answer by SarperS · Mar 29, 2011 at 12:54 PM
It rounds your float to the nearest integer so if you have a 5.6 valued float Mathf.Round(5.6) would return 6. Mathf.Round(5.4) would return 5. If the number ends in .5 so it is halfway between two integers, one of which is even and the other odd, the even number is returned.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
A node in a childnode? 1 Answer
Saving final score and displaying on main menu 1 Answer
null texture passed to GUI.DrawTexture 0 Answers
Get Set Errors C# 2 Answers