# Input Actions
About 10 minutes.
## Learning objectives
- Name the three parts of an Input Actions asset: Action Maps, Actions, Bindings
- Open the default project-wide asset and find **Player/Move** and **Player/Jump**
- State what value type **Move** returns
- Explain why scripts should read actions instead of hard-coded keys
## The three pieces
Do not design a custom map yet. Learn the default asset first.
| Term | What it is | Example in the default asset |
| --- | --- | --- |
| **Action Map** | A group of actions for one situation | `Player`, `UI` |
| **Action** | A named thing the game cares about | `Move`, `Jump`, `Submit` |
| **Binding** | A control that triggers that action | `W`/`A`/`S`/`D`, arrow keys, gamepad left stick |
Your script asks for `Player/Move`. It does not ask for the W key. Bindings can change later. The action name stays the same.
> **Why this matters:** Always use the map/action path (`Player/Move`), not just `"Move"`. If two maps ever share a name, `FindAction("Move")` is ambiguous. `FindAction("Player/Move")` is not.
Official overview: [Quickstart Guide | Input System](https://docs.unity3d.com/Packages/
[email protected]/manual/QuickStartGuide.html)
## Open the default asset
1. Open **Edit > Project Settings > Input System Package**.
2. Confirm the project-wide Action Asset is assigned.
3. Double-click the asset in the Project window (`InputSystem_Actions.inputactions` under `Assets`), or use the Input Actions editor shown in Project Settings.

You should see: two maps, **Player** and **UI**, and a list of actions on the selected map.
## Walk through Player/Move
1. Select the **Player** map.
2. Select the **Move** action.
3. Read **Action Type** / control type. **Move** is a **Value** action with a **Vector2** control type.
4. Expand its bindings.
Typical default bindings for **Move**:
- WASD (composite 2D vector: W up, S down, A left, D right)
- Arrow keys (another 2D vector composite)
- Gamepad left stick
- Often also XR / joystick axes
`ReadValue<Vector2>()` therefore returns:
- `(0, 0)` when idle
- `(0, 1)` when W (or up) is held
- `(-1, 0)` when A (or left) is held
- a stick vector in the range about `(-1..1, -1..1)` on a gamepad
In a 3D scene you usually apply `x` to world X and `y` to world Z.
## Walk through Player/Jump
1. Stay on the **Player** map.
2. Select the **Jump** action.
3. Read the control type. **Jump** is a **Button**.
4. Expand its bindings.
Typical default bindings for **Jump**:
- Space on the keyboard
- South button on a gamepad (A on Xbox, Cross on PlayStation)
Buttons are not Vector2. In code you use `WasPressedThisFrame()`, `IsPressed()`, or a callback's `context.performed`. You do not call `ReadValue<Vector2>()` on Jump.
## The UI map (do not edit)
Select the **UI** map. You should see actions such as **Navigate**, **Submit**, and **Cancel**. Leave them. They feed the Input System UI Input Module if you add a Canvas later.
## Control types you will use in this course
| Control type | Typical action | How you read it |
| --- | --- | --- |
| Vector2 | Move, Look, Navigate | `action.ReadValue<Vector2>()` |
| Button | Jump, Attack, Submit | `action.WasPressedThisFrame()` or `action.IsPressed()` |
Match the read method to the action type. A type mismatch compiles in some cases and then returns a useless default.
## Optional: add one binding
You do not need this for the cube assignment. Use it if you want to see a binding get created.
1. Select **Player > Jump**.
2. Select the **+** next to Bindings.
3. Choose **Add Binding**.
4. Select the new binding's **Path**.
5. Choose **Listen**, then press the key or pad button you want (for example `E`).
6. Save the asset if the Input Actions window shows unsaved changes (Ctrl/Cmd+S).
You should see: Jump lists the new path under Bindings.
To remove it, select that binding and delete it, then save. Leave the original Space and gamepad south bindings in place.
## Why actions beat hard-coded keys
This is the wrong pattern in this course:
```csharp
// Do not do this. Input.GetKey is legacy Input Manager.
if (Input.GetKey(KeyCode.W)) { /* ... */ }
```
Problems:
- WASD is baked into the script
- A gamepad needs a second code path
- Rebinding means editing C#
- With **Active Input Handling** set to **New**, this API is not available and the script fails
The right pattern:
```csharp
Vector2 move = moveAction.ReadValue<Vector2>();
```
Same line for keyboard composites and for a stick.
## Checkpoint
Before you continue to [Move a player](05-move-a-player.md):
- You can name the default maps: **Player** and **UI**
- You can name at least **Move** and **Jump** on the Player map
- You can say **Move** returns a **Vector2**
- You can say **Jump** is a **Button**