Tap & Hold & Rapid Prototyping w/ New Unity Input System

Jordan Evans
3 min readJan 25, 2022

Now let’s take a look at how we can create a charge up effect, similar to that of games like Jump King. In order to start, we will create a new input map and set up our action to have a hold interaction:

From here, we can jump into a new script and start creating our methods. In order to test out how to get the holding of space to create a charge aspect, we will use:

When we test this out within Unity, we can see how holding the space at varying intervals will create different values:

Now, in order to make our object jump at varying heights, we will work with a performed and cancel methods with our input actions:

For the movement itself, we are going to us the AddForce method in an upwards path to propel our object. The difference between the 2 will be the fact that we will have our performed automatically propel our object after being held for the full duration, while in the cancelled method, it will propel itself upwards based on how long it has been held for. Now that we have all of this in place, let’s test it out:

There we have it. We have quickly developed a method in which we can tap/hold down a button to propel an object a distance depending on the length it was help for.

Another new feature that was put in with the new input system is the ability for rapid prototyping. This allows for us to quickly check if something has been pressed on a frame to make sure that we are properly getting the desired buttons to activate the events we desire:

With this, we can easily check if we have had a button press within Unity:

Now that we know a few new ways to go about using the new input system, we can use this knowledge to help make creating future projects easier.

--

--