Is there a setting to change integer rounding to 'Swedish Rounding'?

Hi all,

Just to quickly preface this question, Swedish Rounding is a system where you round decimals to the nearest integer. So 5.3 will be rounded to 5, and 5.7 will be rounded to 6.

In Unity, I've found that if you have two numbers, one an int, and the other a float, and you make the int equal the float, the decimal value is rounded down no matter what(so 5.3 will equal 5, and so will 5.7). Basically it's like any number after the decimal point is ignored. Is there a setting in Unity to change this, or will I have to script something like this every time I want to round this way:

var inputNumber : float;

private var outputNumber : int;
private var xInt : int;
private var remainder : float;

function Update()
    xInt = inputNumber;
    remainder = inputNumber - xInt;
    if (remainder >= 0.5)
        outputNumber = inputNumber+1;
        outputNumber = inputNumber;


Thanks for your help!

Mathf.Round is what you need.

Or add 0.5f to the float value int val = fval + 0.5f;