How do I make my object move by exactly one in unity?

I’ve been trying to make a game similiar to the game “sokoban” (also known as “box pusher” to some people??) and I was wondering how I would make the box move by exactly 1 integer. so for example when I run into it, it moves from position 3 on the x to position 4 (or 2 if i push it left). I’m not sure how I’d do this though. I don’t think the “addforce” or “velocity” functions would work. Does anybody have any suggestions?

If you’d want to move it instantly, do like SamElTerrible wrote. If you want to do it smoothly, you could use LeanTween, just like that.

asset store link

	LeanTween.move(gameObject, transform.position + Vector3.right * 1f, .2f).setEaseOutBounce();

Should look neater with that bounce at the end.
Also you could use this for your character animations, you could draw your own paths to follow etc.

You’re right, AddForce and Velocity are for physics, but you want to move things by a fixed number.

If you want to move a box by one unit on the X axis, you can do something like:

Vector2 newPosition = new Vector2(box.transform.position.x + 1, box.transform.position.y);
box.transform.position = newPosition;

When ever you move your object make it snap, you can do this by using mathf.round on the X,Y,Z of the transform, this kind of thing works for tile based movement and building systems that’s need to use a grid.