> For the complete documentation index, see [llms.txt](https://malbersanimations.gitbook.io/animal-controller/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://malbersanimations.gitbook.io/animal-controller/malbers-questforge/controller-support/input-setup.md). Agents can also search and read this documentation through its [MCP server](https://malbersanimations.gitbook.io/animal-controller/~gitbook/mcp).

# Input Setup

Quest Forge's buttons come from two places:

* **Player actions** live in the player's input asset and reach Quest Forge through the **Quest Forge Input Bridge**. These are the gameplay buttons: open the Map or Journal, advance dialogue, interact, peek the path. The demo player uses the shipped **MalbersQFInputs** asset.
* **Menu commands** belong to the **Input Router**: select, back, tabs, map zoom, waypoints, fast travel, filters and the Controls panel. The router builds its own action map at runtime with the defaults listed below, so it works without any asset.

Both sets of buttons can be rebound by the player on the [Controls screen](https://malbersanimations.gitbook.io/animal-controller/malbers-questforge/controller-support/controls-and-rebinding.md).

***

### MalbersQFInputs

The asset is at `Malbers Quest Forge/Assets/Inputs/MalbersQFInputs.inputactions`. It has two control schemes, **Keyboard and Mouse** (`<Keyboard>`, `<Mouse>`) and **Gamepad** (`<Gamepad>`), and two action maps, **Gameplay** and **UI**.

#### Quest Forge actions (Gameplay map)

| Action            | Keyboard / Mouse         | Gamepad     | Used on                                                                                                                              |
| ----------------- | ------------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `OpenMap`         | M                        | D-pad Up    | Gameplay: opens the World Map. Also closes it again while the map is open.                                                           |
| `CloseMap`        | Esc                      | —           | World Map: closes it. On a gamepad the map closes with B (Cancel).                                                                   |
| `OpenJournal`     | J                        | D-pad Right | Gameplay: opens the Quest Journal. Also closes it again.                                                                             |
| `AdvanceDialogue` | Space, Left Mouse Button | A           | Dialogue and modal windows: continue to the next line.                                                                               |
| `Interact`        | E                        | Y           | Gameplay: talk to an NPC, collect a quest item. Shown in the interaction prompt ("\[Y] Collect").                                    |
| `PeekPath`        | G                        | —           | Gameplay: briefly shows the World Path Guide's ground trail to the tracked objective or waypoint (when the guide is in toggle mode). |

#### Character actions (Gameplay map)

These are the Malbers character's own buttons. They are listed so you can see which controls are already taken.

| Action           | Keyboard / Mouse    | Gamepad                  |
| ---------------- | ------------------- | ------------------------ |
| `Move`           | W A S D, Arrow keys | Left Stick               |
| `Look`           | Mouse movement      | Right Stick              |
| `Sprint`         | Shift               | Left Stick Press (L3)    |
| `MainAttack`     | Left Mouse Button   | LT                       |
| `SecondAttack`   | Right Mouse Button  | RT                       |
| `Action3`        | R                   | LB                       |
| `Action4`        | F                   | RB                       |
| `Jump`           | Space               | A                        |
| `Crouch`         | C                   | B                        |
| `Ability1`       | Q                   | X                        |
| `SpeedUp`        | 2                   | —                        |
| `SpeedDown`      | 1                   | —                        |
| `UpDown` (axis)  | Space (+) / C (−)   | A (+) / B (−)            |
| `LockOn`         | Middle Mouse Button | Right Stick Press (R3)   |
| `LockNextTarget` | Mouse Wheel         | Right Stick (directions) |
| `Reload`         | R                   | LB                       |
| `Zoom`           | Mouse Wheel         | —                        |
| `Holster1`       | 4                   | D-pad Left               |
| `Holster2`       | 5                   | —                        |
| `Holster3`       | 6                   | —                        |
| `Strafe`         | Tab                 | D-pad Down               |
| `Join`           | Enter               | Start                    |
| `Pause`          | Esc (triple tap)    | Start                    |
| `Return`         | Enter (triple tap)  | Start                    |
| `Inventory`      | I                   | View (Select)            |

A, B, D-pad Left and D-pad Down are shared with Quest Forge's menu commands. That is safe: while a Quest Forge screen is open, the [Gameplay Input Blocker](broken://pages/5b56064ba3cd60c19a94ff30290544b08f55dd11#gameplay-blocking) switches the character's buttons off, so a press only reaches the menu.

#### UI map

The **UI** map holds the actions Unity's UI module normally uses (`Navigate`, `Submit`, `Cancel`, `Point`, `Click`, `ScrollWheel`, `MiddleClick`, `RightClick`). `Navigate` reads the left stick, right stick, D-pad, a joystick, W A S D and the arrow keys.

By default you don't need to touch it: the Input Router gives the EventSystem its own **Submit** and **Cancel** (see **Drive UI Submit Cancel** below), so UI buttons answer A / Enter and B / Esc and follow the player's rebinds.

***

### Menu Commands (Input Router defaults)

The router's commands are not in MalbersQFInputs. The router creates them at runtime (an action map called **QuestForgeUI**) with these defaults. The Controls screen lists them under **QuestForge**.

| Command              | Keyboard / Mouse | Gamepad                | Used on                                                                                           |
| -------------------- | ---------------- | ---------------------- | ------------------------------------------------------------------------------------------------- |
| `Submit`             | Enter            | A                      | Every screen: select, confirm, press the focused button. **Locked** (can't be rebound).           |
| `Cancel`             | Esc              | B                      | Every screen: close the top screen, back out. **Locked**.                                         |
| `Interact`           | E                | X                      | Journal: Track / Untrack. Map: Remove a waypoint. Controls: Reset. On-screen keyboard: Delete.    |
| `PreviousTab`        | Q                | LB                     | Journal: previous category. Controls: switch tab. On-screen keyboard: Shift.                      |
| `NextTab`            | Tab              | RB                     | Journal: next category. Controls: switch tab.                                                     |
| `MapZoomIn`          | =                | RT                     | World Map.                                                                                        |
| `MapZoomOut`         | −                | LT                     | World Map.                                                                                        |
| `MapCenterOnPlayer`  | C                | Right Stick Press (R3) | World Map.                                                                                        |
| `MapPlaceWaypoint`   | F                | Y                      | World Map: place a waypoint at the crosshair. On-screen keyboard: Space.                          |
| `MapCyclePrevPOI`    | \[               | D-pad Left             | World Map: previous point of interest.                                                            |
| `MapCycleNextPOI`    | ]                | D-pad Right            | World Map: next point of interest.                                                                |
| `MapFastTravel`      | Enter            | A                      | World Map: Travel, Track or Untrack the selected icon. May share Submit's button on purpose.      |
| `MapFilterToggle`    | G                | D-pad Down             | World Map: open / close the map filters.                                                          |
| `ToggleControlsMenu` | F1               | Start                  | Opens / closes the Controls screen. Start is **locked** on the gamepad. On-screen keyboard: Done. |
| `OpenFactionJournal` | R                | Y                      | Journal: open the Reputation screen. Controls: Reset All.                                         |
| `MapPan`             | W A S D          | Left Stick             | World Map pan, and stick scrolling on read-only lists. Not shown on the Controls screen.          |

{% hint style="info" %}
Start is Pause during gameplay. It only opens the Controls screen while the Journal, World Map or Reputation screen is open. F1 opens Controls from gameplay as well.
{% endhint %}

Two commands only clash when they can be live on the same screen. Map commands and Journal commands can share buttons (Y is Place Waypoint on the map and Reputation in the journal). `Submit` and `MapFastTravel` are a deliberate pair: on the map, A both confirms and travels.

***

### Changes from v1

If you used Quest Forge v1.X with the shipped input asset, note these changes in **MalbersQFInputs**:

| Change                   | v1                            | v2                                    |
| ------------------------ | ----------------------------- | ------------------------------------- |
| **D-pad Up**             | Holster 3                     | Opens the Map (`OpenMap`)             |
| **D-pad Right**          | Holster 2                     | Opens the Journal (`OpenJournal`)     |
| **A (south button)**     | No dialogue binding           | Advances dialogue (`AdvanceDialogue`) |
| **Keyboard Fast Travel** | Invalid binding, never worked | Enter                                 |

`Holster2` and `Holster3` now have keyboard bindings only (5 and 6).

If your player uses its own copy of the asset, run **One-Click Setup** or the **Fix** next to "Player is set up for QuestForge" in the Controller & UI tab. It adds the Quest Forge actions with default bindings where the controls are free. When a D-pad direction is already taken (for example D-pad Up on Holster3 in the Animal Controller's inputs), the Helper's Fix moves it to the Quest Forge action, as the shipped asset does.

{% hint style="info" %}
**With Inventory V3 installed**, its hotbar and Swap Hands own the D-pad. The player setup then leaves the D-pad alone: the Journal goes on **View** (Select) instead of D-pad Right, and the Map gets no gamepad default. Players can give it one on the Controls screen.
{% endhint %}

***

### Quest Forge Input Bridge

The bridge sits on the player next to **MInputLink** (or **MalbersInput**). Each Quest Forge input row's **On Input Down** event calls one of its methods, and the bridge passes the press on to Quest Forge. Quest Forge never holds a reference to the player, so the bridge can be destroyed and respawned with the player.

Add it with **Add Component → Malbers → Quest Forge → Quest Forge Input Bridge**, or let One-Click Setup add and wire it.

#### Validation

| Property              | Type  | Description                                                                                                                                                                                          |
| --------------------- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Validate On Start** | bool  | Checks at startup that every Quest Forge input exists on the player's input component, has a working action, and is wired to the bridge. Problems are logged as one error with the fix. Default: on. |
| **Validation Delay**  | float | Seconds to wait before checking, so **MInputLink** has finished setting up its actions. Default: 0.5.                                                                                                |

#### Wiring

| Input row         | On Input Down calls   |
| ----------------- | --------------------- |
| `OpenMap`         | `FireOpenMap`         |
| `CloseMap`        | `FireCloseMap`        |
| `Interact`        | `FireInteract`        |
| `AdvanceDialogue` | `FireAdvanceDialogue` |
| `PeekPath`        | `FirePeekPath`        |
| `OpenJournal`     | `FireOpenJournal`     |

The player setup also wires `Interact` to the player's **MInteractor**.

The validation error has three kinds of problem:

* **Broken action references.** The row's Input Action Reference points at an action that is not in the asset **PlayerInput** uses. This usually happens after an asset update. Clear the row's **Input Action Reference** and pick the action again from the same asset **PlayerInput.actions** points to.
* **Missing inputs.** No row with that name exists, or the wrong action map is active.
* **Unwired.** The row exists, but its **On Input Down** has no persistent call to the bridge.

You can run the check by hand in Play Mode from the component's context menu: **Validate Input Bindings (Play Mode only)**.

The bridge also lists the player's buttons in the **Character** section of the Controls screen.

***

### Input Router

The router owns Quest Forge's menu commands, tracks the active device, and saves rebinds. One-Click Setup adds it to the **ControllerSupport** object. Add it by hand with **Add Component → Malbers → Quest Forge → Controller → Input Router**. Only one router is used per scene.

#### Inspector Properties

| Property                          | Type             | Description                                                                                                                                                                                                                  |
| --------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Actions**                       | InputActionAsset | Optional. An asset with an action map named **Action Map Name**. The router uses a copy of it (your asset is never changed) and adds any commands it lacks. Leave empty to use the built-in defaults.                        |
| **Action Map Name**               | string           | The map to look for in **Actions**. Default: `QuestForgeUI`.                                                                                                                                                                 |
| **Persist Binding Overrides**     | bool             | Save the player's rebinds to the shared Malbers controls file and load them on start. Default: on.                                                                                                                           |
| **Drive UI Submit Cancel**        | bool             | Give the scene's Input System UI module this router's Submit and Cancel actions, so UI buttons answer the same Select and Back as Quest Forge's screens and follow rebinds. Off keeps the module's own actions. Default: on. |
| **Prefer Gamepad When Connected** | bool             | Start in gamepad mode when a gamepad is connected, and switch to it when one is plugged in, so prompts and focus are right before the player presses anything. Default: on.                                                  |

***

### Using Your Own Input Asset

**For the player's buttons**, point the player's **PlayerInput** at your asset and run the player setup (One-Click Setup, or the Fix in the Controller & UI tab). It adds `OpenMap`, `CloseMap`, `OpenJournal`, `AdvanceDialogue`, `Interact` and `PeekPath` to your asset if they are missing, binds the defaults where those controls are free, adds the rows to **MInputLink** and wires them to the bridge. Existing actions, bindings, rows and calls are never removed or replaced. The setup asks before it rewrites the asset file.

**For the menu commands**, you can leave the router's **Actions** empty. If you want them in your own asset, add an action map named `QuestForgeUI` (or set **Action Map Name**) with button actions named exactly as in the table above (`Submit`, `Cancel`, `Interact`, `PreviousTab`, …) and a Value action named `MapPan`, then assign the asset to the router's **Actions**. Any command your map lacks is added with its default.

{% hint style="warning" %}
Keep Quest Forge's action names as they are. Rebinds are saved by action name, device and slot, and the input bridge, prompt bar and `{Interact}` tokens look actions up by name.
{% endhint %}

***

### Public API

```csharp
// The scene's router (null before it wakes).
QuestForgeInputRouter router = QuestForgeInputRouter.Instance;

// Which device the player is using, and when it changes.
QuestForgeInputDeviceMode mode = router.DeviceMode;          // KeyboardMouse or Gamepad
router.DeviceModeChanged += m => Debug.Log(m);

// Every menu command press (after the screen state is snapshotted).
router.CommandPerformed += command => { /* QuestForgeUICommand */ };

// Raised after any rebind, reset or restore, so your prompts can refresh.
router.BindingsChanged += () => { };

// Send a command from your own input or a test.
router.Dispatch(QuestForgeUICommand.Cancel);

// The InputAction behind a command, e.g. for your own glyph lookup.
InputAction submit = router.GetAction(QuestForgeUICommand.Submit);

// Left stick / WASD map-pan vector.
Vector2 pan = router.ReadMapPan();

// Point a new EventSystem's UI module at the router's Submit/Cancel (after swapping EventSystems at runtime).
router.AttachUIInputModule(null);

// The default command table (action, command, keyboard path, gamepad path, scope).
IReadOnlyList<QuestForgeCommandBinding> defaults = QuestForgeInputRouter.DefaultBindings;
```

Quest Forge Input Bridge methods, for wiring by hand:

```csharp
public void FireOpenMap();
public void FireCloseMap();
public void FireInteract();
public void FireAdvanceDialogue();
public void FirePeekPath();
public void FireOpenJournal();
public bool Validate(); // logs one consolidated error and returns false when something is wrong
```

***

### Notes

* **Legacy input.** With **MalbersInput** (the old Input Manager) the bridge still validates rows by name and wiring. Glyphs in prompts work best with **MInputLink**.
* **One router.** A second router in the scene removes itself.
