Moving an object a specific amount of units.

When I click on a game object, I’d like it to move a specific amount of units on my X axis. For Example, I have a cylinder, that when clicked on moves exactly 20 units on my X axis.

I don’t want it to move to another object, just 20 units in a certain direction. If anyone could help me with this problem I’d be forever grateful.

When you detect the click just change the x position:

transform.position.x += 20;

This will change the position on the x axis 20 units, just make sure ‘transform’ is the transform of the object you want to move.