Round x, y and z values of object?

Hey, I’m wanting to have the objects in my scene snap to a grid and so Ive been trying to round the x, y and z values of these objects to the nearest full numbers hoping it would give this effect. My script uses Mathf.round which Ive read does this, however what I have wrote doesn’t do anything at all, can someone help me out here?

function Update (){

Mathf.Round(transform.position.x);
Mathf.Round(transform.position.y);
Mathf.Round(transform.position.z);
}

Of course not, it DOES do something with the vectors of position, it just doesn’t change the value of the vectors in position since the method Mathf.Round is returning a value(the changed value) to nothing.

try:

function Update (){
 
  transform.position.x = Mathf.Round(transform.position.x);
  transform.position.y = Mathf.Round(transform.position.y);
  transform.position.z = Mathf.Round(transform.position.z);
}