Master Unity Input Tutorial: Complete Guide to Handling User Input

Robert Jul 13, 2026

Welcome, developers, to a comprehensive guide on Unity's input handling system. Unity provides robust input management, enabling interactions between your game and the user's input devices. Let's dive into understanding and implementing Unity's input system.

Unity Tutorial For Beginners - How To Make A Game - Part 002 - TEXTURES & INPUT
Unity Tutorial For Beginners - How To Make A Game - Part 002 - TEXTURES & INPUT

Before we begin, ensure you have a working understanding of C# and the Unity editor. This tutorial will use Unity's new input system introduced in version 2020.1, focusing on standalone and editor testing. Let's get started!

New Unity Input System: Getting Started
New Unity Input System: Getting Started

Understanding Unity Input System

The Unity input system uses a high-level API for managing user inputs. It's designed for easy integration with other systems, offering rich functionality out-of-the-box. The heart of this system is the PlayerInput component, which controls inputs and interacts with devices.

Flexible Interaction System in Unity Tutorial | (Intermediate, Advanced) | Part 1 Getting Input
Flexible Interaction System in Unity Tutorial | (Intermediate, Advanced) | Part 1 Getting Input

двух типов: Empty и ważny. Let's explore the types of inputs and binding management.

Types of Inputs

Gamepad Tutorial for Unity
Gamepad Tutorial for Unity

Action represents an input that changes over time, like a joystick movement or a mouse scroll. Actions return a value representing the current state of the input. There are two types: Vector2 and Vector3, typically used for axes, thumbsticks, and mice.

Button represents a single press of an input, such as a button on a gamepad or the spacebar on a keyboard. Buttons can return either true or false indicating whether the button is pressed or not.

Binding Management

Virtual Joystick mit dem Input System von Unity | Unity Anfänger Tutorial Deutsch
Virtual Joystick mit dem Input System von Unity | Unity Anfänger Tutorial Deutsch

Button and action mapping are defined through bindings. Bindings match input device events with Unity's input actions and buttons. You can manage bindings through Input Actions, which combine multiple bindings into a single asset.

Suppose you want to create an InputAction for a jump action. You can bind it to both the spacebar on the keyboard and the 'A' button on a gamepad. This way, users can jump using either input device.

Setting up Input System

Unity's New Input System - A Beginners Guide
Unity's New Input System - A Beginners Guide

To use the new input system, you need to set up a PlayerInput object in your scene. This object manages inputs and is responsible for processing and providing input data to other scripts.

Right-click in your Hierarchy panel, go to UI > Input System > Player Input. This will add a PlayerInput object to your hierarchy. Now, let's create an input action asset to manage our bindings.

Input System von Unity | Unity Anfänger Tutorial Deutsch
Input System von Unity | Unity Anfänger Tutorial Deutsch
Unity 5 Mobile Joysticks Tutorial - Touch Input 2D Spaceship Controller
Unity 5 Mobile Joysticks Tutorial - Touch Input 2D Spaceship Controller
an image of a computer screen with the words, new in it's system
an image of a computer screen with the words, new in it's system
Learn Unity Input System in 60 SECONDS!
Learn Unity Input System in 60 SECONDS!
Inventory System in Unity Tutorial (Part 2) - Unity3D C# Tutorial
Inventory System in Unity Tutorial (Part 2) - Unity3D C# Tutorial
Unity Made Easy - Creating Text Files [System.IO]
Unity Made Easy - Creating Text Files [System.IO]
4 Ways to Optimize Unity Games Tips and Tricks
4 Ways to Optimize Unity Games Tips and Tricks
Click Objects In Unity - How To Click Objects in Unity 5 | Unity Mouse Tutorial
Click Objects In Unity - How To Click Objects in Unity 5 | Unity Mouse Tutorial
How to use Joystick controller input ( Joystick ) [Tutorial][C#] - Unity 3d
How to use Joystick controller input ( Joystick ) [Tutorial][C#] - Unity 3d
Unity Essentials - Unity Connect
Unity Essentials - Unity Connect
Simple Drag Drop (Unity Tutorial for Beginners)
Simple Drag Drop (Unity Tutorial for Beginners)
Extendible Day & Night Simulation With C# Interfaces - Unity Tutorial
Extendible Day & Night Simulation With C# Interfaces - Unity Tutorial
Button Animation (Using Animator) - Unity 3D[Tutorial][C#]
Button Animation (Using Animator) - Unity 3D[Tutorial][C#]
How to create mobile joystick in Unity 2018 🎮
How to create mobile joystick in Unity 2018 🎮
Materials Instances Done the Right Way  - Unity Tutorial
Materials Instances Done the Right Way - Unity Tutorial
How To Drag 2D/3D Object Unity  [Tutorial]
How To Drag 2D/3D Object Unity [Tutorial]
Unity 5 Tutorial: Swipe Touch Input for Camera Rotation C#
Unity 5 Tutorial: Swipe Touch Input for Camera Rotation C#
How To Build a Custom Input Manager in Unity C#
How To Build a Custom Input Manager in Unity C#
a table that has different types of text on it and an image of the same type
a table that has different types of text on it and an image of the same type
How to Use Unity New Input System
How to Use Unity New Input System

Creating Input Actions

In your Project window, right-click and go to Create > Input Actions. Name your new asset, e.g., "PlayerActions". Double-click to open it. In the "PlayerActions" window, click on "Create New Action". Name it, e.g., "Jump", and set its type to Button.

Now, let's bind Controls to the "Jump" action. Click on the square next to the "Candidate" field. From the list, select the "Space" key for the keyboard and the "AButton" for gamepad. Click "Apply". Your "Jump" action is now ready to use!

Using Input Actions in Scripts

To use an InputAction in your C# scripts, first, import the UnityEngine.InputSystem namespace:

```csharp using UnityEngine.InputSystem; ```

Then, use the PlayerInput instance tied to your PlayerInput object. Cast your PlayerActions from InputActionAsset to InputAction:

```csharp var playerInput = GetComponent(); var jump = playerInput.currentActionMap.FindActionMap("PlayerActions").FindAction("Jump"); ```

Now you can call jump.WasPressedThisFrame() to detect a jump:

```csharp if (jump.WasPressedThisFrame()) { // Jump! } ```

Congratulations! You've now mastered the basics of Unity's input system. Explore deeper functionality, like input remapping and custom binding layouts, to cater to diverse user needs.

Now that you're comfortable with Unity's input system, expand your knowledge with our in-depth guides on UI design and animation. Happy coding!