- Home /
how to round up decimal score
I have a bonus item that doubles the score but I don't want decimals for points so how do I round up the score
float bonusScore = CurrentScore / 10;
CurrentScore += bonusScore;
Comment
Best Answer
Answer by Jason2014 · May 18, 2016 at 05:16 AM
Use Mathf.RoundToInt function.
float bonusScore = CurrentScore / 10;
int roundedBonusScore = $$anonymous$$athf.RoundToInt (bonusScore);
CurrentScore += roundedBonusScore;
Something like this. It should work.