# Troubleshooting About 10 minutes, only if something failed. ## Learning objectives - Match a symptom to one cause - Fix Active Input Handling, project-wide actions, and script setup without guessing Work top to bottom. Change one thing, then retest in Play mode. ## Quick checks | Symptom | First thing to verify | | --- | --- | | Nothing happens when you press keys | You are in **Play** mode and the **Game** view has focus | | `InputAction` will not compile | `using UnityEngine.InputSystem;` is at the top of the script | | `FindAction` returns null | Project-wide asset is assigned; the path is `"Player/Move"` | | Cube sits still | `PlayerMover` is on `Player` and enabled; `moveSpeed` is not `0` | | UI clicks do nothing | EventSystem uses **Input System UI Input Module** | | `Input.GetAxis` / `Input.GetKey` errors | **Active Input Handling** is **New**; delete that legacy code | ## Editor did not restart after Active Input Handling **Edit > Project Settings > Player > Other Settings > Configuration > Active Input Handling** only applies after an Editor restart. 1. Set it to **Input System Package (New)** again. 2. Close Project Settings. 3. If Unity did not prompt, close the Editor from **File > Exit** (or the window close button). 4. Reopen the project from Hub. 5. Recheck the dropdown. You should see: **Input System Package (New)** is still selected after the restart. ## `InputSystem.actions` is null, or FindAction returns null `InputSystem.actions` is the project-wide Action Asset. If none is assigned, it is null. If the name is wrong, `FindAction` returns null and `PlayerMover` bails out in `Update`. 1. Open **Edit > Project Settings > Input System Package**. 2. If there is no asset, select **Create and assign a default project-wide Action Asset**. 3. In `PlayerMover`, use `FindAction("Player/Move")`, not `"Move"` and not `"player/move"`. 4. Open the `.inputactions` asset and confirm the map is named **Player** and the action is named **Move**. You should see: `InputSystem.actions` is assigned, and a temporary `Debug.Log(moveAction)` in `Start` is not `null`. Remove the log after it works. ## Cube does not move Run these in order: 1. Confirm you pressed **Play**. Edit mode will not run this movement. 2. Click the Game view so keyboard focus is not in the Scene view, Console, or a text field. 3. Select `Player`. Confirm **Player Mover** is present and enabled. 4. Confirm **Move Speed** is greater than `0`. 5. Confirm you did not also leave a disabled script as the only component — the enabled one must be `PlayerMover` (page 05) or `PlayerMoverEvents` (page 06), not both enabled. 6. Search your scripts for `Input.GetAxis` or `Input.GetKey`. Delete those calls. They are the old Input Manager and fail when Active Input Handling is **New**. 7. Add this inside `Update` after `ReadValue`, play, and hold W: ```csharp Debug.Log(move); ``` - `(0.00, 0.00)` while holding W means the action is not receiving keyboard input (wrong map, Game view unfocused, or backends not enabled). - `(0.00, 1.00)` means input works and the transform code is the problem (you are translating along the wrong axes, or the camera is looking so the motion is hard to see). ## CS0246: InputAction could not be found The compiler cannot see the Input System types. 1. Confirm the first two lines of the script are: ```csharp using UnityEngine; using UnityEngine.InputSystem; ``` 2. Confirm **Window > Package Manager** shows **Input System** installed. 3. Confirm **Active Input Handling** is **Input System Package (New)** or **Both**, then restart the Editor. 4. Wait for the script to recompile. `InputAction` lives in `UnityEngine.InputSystem`, not in `UnityEngine`. ## UI / EventSystem broken after switching When Active Input Handling is **New** or **Both**, uGUI needs **Input System UI Input Module**. **Standalone Input Module** talks to the old Input Manager. 1. Select **EventSystem** in the Hierarchy (Unity creates it when you add a Canvas). 2. If the Inspector shows **Standalone Input Module**, remove it. 3. **Add Component > Input System UI Input Module**. 4. If Unity shows a button to replace the old module, use that button. This starter does not need a Canvas. Only do this if UI clicks or Submit stopped working. ## Both vs New, leftover Input Manager code | Active Input Handling | `Input.GetKey` / `Input.GetAxis` | Input System actions | | --- | --- | --- | | Input Manager (Old) | Works | Does not | | Input System Package (New) | Does not | Works | | Both | Works | Works | This course is **New**. If a tutorial or autocomplete inserts `Input.GetAxis("Horizontal")`, do not keep it. **Both** exists so an old project can migrate one script at a time. It also lets students "fix" a broken script by turning the old API back on. Leave **Both** off unless your instructor says otherwise. Defines you may see in code: - `ENABLE_INPUT_SYSTEM` when the new backends are on - `ENABLE_LEGACY_INPUT_MANAGER` when the old backends are on ## Package missing after a Hub template without Keep Project Settings If you created this project from a custom course template and Package Manager shows Input System but **Active Input Handling** is still **Input Manager (Old)**, the template was saved with **Keep Project Settings** off. That is an instructor fix. See [Save as a course template](08-save-as-template.md). Until it is fixed: 1. Set **Active Input Handling** to **Input System Package (New)** yourself. 2. Restart the Editor. 3. Assign the project-wide Action Asset if it is missing. ## Player Input events never fire 1. **Behavior** must be **Invoke Unity Events**. 2. **Default Map** must be **Player**. 3. The event function must be `public void OnMove(InputAction.CallbackContext context)` (or `OnJump` with the same signature). 4. The dropdown must show **PlayerMoverEvents.OnMove**, not a `MonoBehaviour` method with no arguments. 5. Disable `PlayerMover` so it is not competing, and do not read `InputSystem.actions` from the same object. Jump logs three times if you skip `if (context.performed)`. ## Checkpoint You can continue when: - Play mode moves the cube with WASD or arrows - The Console has no compile errors - **Active Input Handling** is **Input System Package (New)**