pressing a key by user !

How can i define an event that only occurs once by pressing a key. As an example, when I want to move a cube 1 unit to right, it is moved unpredicted number of units to right and it is not controlable.

void Update()

Come on it’s not that hard.

Or for a key use:


Depends, if the want to object to “slide” 1 place to the right, then you’ll need to use a Coroutine with a Vector3.Lerp.

else use this:

Transform.position.x += 1;