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.

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!

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.

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

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

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

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.





![Unity Made Easy - Creating Text Files [System.IO]](https://i.pinimg.com/originals/e1/74/37/e174379d266ce866f523a347b264d8c1.jpg)


![How to use Joystick controller input ( Joystick ) [Tutorial][C#] - Unity 3d](https://i.pinimg.com/originals/80/a4/89/80a4897b4c72ef413b786e744c98283a.jpg)



![Button Animation (Using Animator) - Unity 3D[Tutorial][C#]](https://i.pinimg.com/originals/2b/39/46/2b394677b71af98f633162f63d517449.jpg)


![How To Drag 2D/3D Object Unity [Tutorial]](https://i.pinimg.com/originals/12/63/8c/12638cf661d3911e1285bb33f258102f.jpg)




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 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!