there must be an easy way to state a number rounded off to a certain number of digits after the decimal point?

```
var numbertoround:float;
numbertoround=5.1203404030;
if (numbertoround==5){i want stuff to happen here!}
```

there must be an easy way to state a number rounded off to a certain number of digits after the decimal point?

```
var numbertoround:float;
numbertoround=5.1203404030;
if (numbertoround==5){i want stuff to happen here!}
```

if(Math.floor(numbertoround) == 5) {

//stuffâ€¦

}

something along those lines. syntax is prolly off a bit.

You can also use:

```
(float)System.Math.Round(number, 3);
```

Reading that you are looking for Vector3s I would create an ExtensionMethods class with the following:

```
Vector3 Round(this Vector3 v3) { return new Vector3(Mathf.Round(v3.x), Mathf.Round(v3.y), Mathf.Round(v3.z)); }
Vector3 Floor(this Vector3 v3) { return new Vector3(Mathf.Floor(v3.x), Mathf.Floor(v3.y), Mathf.Floor(v3.z)); }
Vector3 Ceil(this Vector3 v3) { return new Vector3(Mathf.Ceil(v3.x), Mathf.Ceil(v3.y), Mathf.Ceil(v3.z)); }
```

then add a using statement to that class to whatever classes need to be able to use these extensions. Then you can run:

```
if(MyVec3.Round().x == 5)
{
// Your Code
}
```