Rapid Prototyping w/ New Unity Input System

Objective: Review how to implement a rapid prototype with the new input system

Ed Hepplewhite
3 min readJul 26, 2023

With Unity’s new input system it’s easy to get key bindings tested out. Make sure you have UnityEngine.InputSystem as a using statement.

Then, in update we can simple run an if statement check to see if a button is being pressed.

We are able to check for either keyboard or mouse input and then pass in the button press we want to check. Then we just add in “wasPressedThisFrame” and we have our basics running without having to create an action map.

It’s also easy to get started with mobile controls with something such as a joystick. To get setup, I’ve created a player cube and a floor. Next, I’ll drop in a UI image and change the image to a circle.

On the joystick image, we can add a component called “On-Screen Stick”. Now, set the control path to Joystick > Stick.

In the Event System in the Hierarchy, make sure to select “Replace with InputSystemUIInputModule”, or else you may run into some errors.

If we go into play mode, we see that we can move the joystick around, it just doesn’t do anything yet.

In our Input Actions, create a new action and call it “Movement”. This will be of action type “value”. Then the control type is a vector 2.

For our binding, we can select Joystick > Stick.

In our Player script, we do the same thing we would do if we had been using the WASD keys.

Now our joystick works!

--

--