Tap & Hold w/ New Unity Input System.

Suleiman Abdullah
2 min readFeb 20


Objective: Tap & Hold w/ New Unity Input System.

Before doing this I will create an a plane ,and add a cube with rigidbody and set use gravity to true.Then I will cache a rigidbod at the start method and name variable as rb.

In the first step I will create an action map called ball and its action called bouncing with space key as binding.

In this step I will select bouncing and add interaction of type hold with maximum of 1 second.

I will create PlayerInputAction reference then create instance,i will enable my action map and and create perfomed function.

To make the ball move up,I will use rigidbody.AddForce.

In this step I will register a cancelled perfomed function.

In this step want to move the ball go up a little bit according how the player hold a space button,we do this using context duration.Then we take context duration we multiply with force then cast it as float.

Lets see the result.

See you in the next article.



Suleiman Abdullah

Self taught Unity Developer, who is passion about making games ,and he loves Math For Game Development