> For the complete documentation index, see [llms.txt](https://dante-3.gitbook.io/dante-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dante-3.gitbook.io/dante-docs/modular-input-system/core-concepts/settings-and-rebinding.md).

# Settings and Rebinding

The plugin covers the input settings almost every game needs, without shipping any widgets: the screens stay yours to style.

| Piece                 | Class                                                                  | Module               |
| --------------------- | ---------------------------------------------------------------------- | -------------------- |
| Look settings         | `UMIPS_InputUserSettings`                                              | ModularInputSystem   |
| Modifiers             | **Invert Look (User Settings)**, **Look Sensitivity (User Settings)**  | ModularInputSystem   |
| Settings view model   | `UMIPS_InputSettingsViewModel`                                         | ModularInputSystemUI |
| Rebinding view models | `UMIPS_KeyMappingListViewModel`, `UMIPS_KeyMappingViewModel`           | ModularInputSystemUI |
| Device tracking       | **Get Input Device Tag**, **On Input Device Changed** on the component | ModularInputSystem   |

***

## Look Settings

`UMIPS_InputUserSettings` extends Enhanced Input's user settings with inverted look axes and per-axis look sensitivity for mouse and gamepad. The values are saved together with the rest of the player's input settings.

### Enable it

{% stepper %}
{% step %}
Open **Project Settings > Engine > Enhanced Input > User Settings**.
{% endstep %}

{% step %}
Tick **Enable User Settings**.
{% endstep %}

{% step %}
Set **User Settings Class** to `MIPS_InputUserSettings`, or to your own subclass of it.
{% endstep %}
{% endstepper %}

### Settings

| Setting             | Default | Range               | Getter / Setter                                           |
| ------------------- | ------- | ------------------- | --------------------------------------------------------- |
| Invert Look X       | Off     |                     | **Is Look X Inverted** / **Set Look X Inverted**          |
| Invert Look Y       | Off     |                     | **Is Look Y Inverted** / **Set Look Y Inverted**          |
| Mouse Sensitivity   | (1, 1)  | 0.05 to 10 per axis | **Get Mouse Sensitivity** / **Set Mouse Sensitivity**     |
| Gamepad Sensitivity | (1, 1)  | 0.05 to 10 per axis | **Get Gamepad Sensitivity** / **Set Gamepad Sensitivity** |

Reach the object with **Get Modular Input User Settings** (from a player controller). It returns nothing when the project uses a different settings class. Setters clamp to the range and broadcast Enhanced Input's settings-changed event. Save with Enhanced Input's **Save Settings** / **Async Save Settings**, or with the view model's **Save**.

## Applying the Settings: Modifiers

Settings do nothing until something reads them. Two input modifiers do, on your look mappings:

| Modifier                             | Properties                                                                                                                 | Without the settings class |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| **Invert Look (User Settings)**      | **Invert X**, **Invert Y**: whether the player's setting may flip that axis (both on by default)                           | Passes the value through   |
| **Look Sensitivity (User Settings)** | **Source**: *Mouse* or *Gamepad*. **Scale**: extra multiplier on top of the player's setting, e.g. while a scope is zoomed | Applies only **Scale**     |

A typical look setup in the mapping context:

```
IMC_Hero
├── IA_Look ◄── Mouse XY 2D-Axis
│     └── Modifiers: Invert Look (User Settings), Look Sensitivity (User Settings) [Source: Mouse]
└── IA_Look ◄── Gamepad Right Thumbstick 2D-Axis
      └── Modifiers: Dead Zone, Invert Look (User Settings),
                     Look Sensitivity (User Settings) [Source: Gamepad], Scale By Delta Time
```

{% hint style="info" %}
When mouse and stick share one action and one **Look** processor, put Enhanced Input's **Scale By Delta Time** modifier on the stick mapping and leave the processor's own *Scale By Delta Time* off. Mouse input is already frame-independent; stick input is a rate.
{% endhint %}

## A Settings Screen

`UMIPS_InputSettingsViewModel` exposes the look settings as field-notify properties, ready to bind checkboxes and sliders to.

| Member                                                             | Kind         | Description                                                                                                |
| ------------------------------------------------------------------ | ------------ | ---------------------------------------------------------------------------------------------------------- |
| `Initialize(PlayerController)`                                     | Function     | Reads the local player's settings. Does nothing when the project does not use Modular Input user settings. |
| `HasSettings()`                                                    | Pure         | True when settings were found, i.e. the screen has something to show.                                      |
| `bInvertLookX`, `bInvertLookY`                                     | Field notify | Current invert settings.                                                                                   |
| `MouseSensitivity`, `GamepadSensitivity`                           | Field notify | Current sensitivity; one value per device, applied to both axes.                                           |
| `SetInvertLookX/Y`, `SetMouseSensitivity`, `SetGamepadSensitivity` | Functions    | Write straight into the user settings.                                                                     |
| `GetMinSensitivity()`, `GetMaxSensitivity()`                       | Pure         | The allowed range (0.05 to 10), for slider limits.                                                         |
| `Save()`                                                           | Function     | Writes the settings to disk. Call it when the player leaves the screen.                                    |
| `Refresh()`                                                        | Function     | Re-reads everything, e.g. after another screen changed a setting.                                          |

In your settings widget:

{% stepper %}
{% step %}
Add the view model in the widget's **View Bindings / Viewmodels** panel with the creation type you prefer (for example *Manual*).
{% endstep %}

{% step %}
Create it and call **Initialize** with the owning player, then hand it to the widget.
{% endstep %}

{% step %}
Bind a checkbox's *Is Checked* to `bInvertLookY` and its *On Check State Changed* to **Set Invert Look Y**; bind sliders the same way, with `GetMinSensitivity` and `GetMaxSensitivity` as limits.
{% endstep %}

{% step %}
Call **Save** when the screen closes.
{% endstep %}
{% endstepper %}

## A Rebinding Screen

### Prepare the mappings

Only mappings registered with Enhanced Input's user settings can be rebound:

{% stepper %}
{% step %}
In the Input Config, tick **Register With User Settings** on the mapping context entry.
{% endstep %}

{% step %}
In the mapping context, give each rebindable mapping **Player Mappable Key Settings** with a unique **Name**, a **Display Name** and a **Display Category**.
{% endstep %}
{% endstepper %}

### `UMIPS_KeyMappingListViewModel`

Every rebindable key of the local player's active key profile.

| Member                                      | Kind         | Description                                                                  |
| ------------------------------------------- | ------------ | ---------------------------------------------------------------------------- |
| `Initialize(PlayerController)`              | Function     | Reads the player's current key profile. Call again after switching profiles. |
| `Entries`                                   | Field notify | Every entry, sorted by category, then by display name.                       |
| `KeyboardAndMouseEntries`, `GamepadEntries` | Field notify | The same entries split by device, for the usual two-column layout.           |
| `GetCategories()`                           | Pure         | Categories in display order.                                                 |
| `GetEntriesInCategory(Category)`            | Pure         | Entries of one category.                                                     |
| `Refresh()`                                 | Function     | Re-reads every mapping.                                                      |
| `ResetAllToDefaults()`                      | Function     | Puts every row back to the keys the game shipped with, and saves.            |

### `UMIPS_KeyMappingViewModel`

One rebindable key, ready to bind a row widget to.

| Member                                            | Kind         | Description                                                                                                   |
| ------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------- |
| `DisplayName`, `DisplayCategory`                  | Field notify | From the mapping's Player Mappable Key Settings.                                                              |
| `CurrentKey`, `CurrentKeyName`                    | Field notify | The key the player is on now, and its display name for rows without icons.                                    |
| `KeyIcon`                                         | Field notify | A platform icon for the current key, from Common Input's platform settings. Empty when the platform has none. |
| `bIsCustomized`                                   | Field notify | True while the key differs from the default; what "reset" buttons watch.                                      |
| `Rebind(NewKey, OutFailureReason)`                | Function     | Puts a new key on the mapping and saves. Returns false with Enhanced Input's failure reason tags on failure.  |
| `ResetToDefault()`                                | Function     | Puts the mapping back to its default key and saves.                                                           |
| `GetMappingName()`, `GetSlot()`, `GetDeviceTag()` | Pure         | Identify the row; the device tag is a `ModularInput.Device.*` tag.                                            |

### Building the screen

```
W_ControlsScreen
├── On Construct: Create MIPS_KeyMappingListViewModel ─► Initialize (Owning Player) ─► set on widget
├── ListView "KeyboardList" ◄── bound to KeyboardAndMouseEntries
├── ListView "GamepadList"  ◄── bound to GamepadEntries
└── Button "Reset All"      ──► ResetAllToDefaults

W_KeyRow (list entry, implements User Object List Entry)
├── On List Item Object Set: set the row's MIPS_KeyMappingViewModel to the item
├── Text  ◄── DisplayName
├── Image ◄── KeyIcon            (or Text ◄── CurrentKeyName)
├── Input Key Selector ── On Key Selected ──► Rebind (Selected Key)
└── Button "Reset" (visible while bIsCustomized) ──► ResetToDefault
```

UMG's **Input Key Selector** widget is a convenient way to capture the new key.

## Key Prompts That Follow the Device

The Modular Input Component tracks what the player is using right now:

| Member                                                       | Description                                                                                                                  |
| ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| **Get Input Device Tag**                                     | `ModularInput.Device.KeyboardAndMouse`, `.Gamepad`, `.Touch` or `.Other`. Racing wheels and flight sticks count as gamepads. |
| **Is Using Gamepad** / **Is Using Keyboard And Mouse**       | The common questions, answered directly.                                                                                     |
| **On Input Device Changed** `(DeviceTag, PreviousDeviceTag)` | Fires when the player picks up a different kind of device.                                                                   |

A prompt widget listens to **On Input Device Changed** and swaps its icon set. In a rebinding screen, show the rows whose **Get Device Tag** matches the current device first, or highlight the matching column.

Device changes are reported per local player, so split-screen players each follow their own controller.

## Next Steps
