> For the complete documentation index, see [llms.txt](https://october-studio.gitbook.io/monster-survivors-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://october-studio.gitbook.io/monster-survivors-documentation/input/input-system.md).

# Input System

The game uses [Input System](https://docs.unity3d.com/Packages/com.unity.inputsystem@1.12/manual/index.html) and allows seamlessly switching between different devices during any stage of gameplay.

{% hint style="info" %}
Input system was added in the 1.0.2 version of the game. It features slight changes to the scene hierarchy. We recomend creating a back up of your project before updating to this version of the template.
{% endhint %}

| Platform             | Input Gameplay                 | Input UI                 |
| -------------------- | ------------------------------ | ------------------------ |
| PC                   | UI Joystick, Gamepad, Keyboard | Mouse, Gamepad, Keyboard |
| WebGL                | UI Joystick, Gamepad, Keyboard | Mouse, Gamepad, Keyboard |
| Mobile (IOS/Android) | UI Joystick, Gamepad           | Touch, Gamepad           |

### Input Asset

Input Asset located at:![](/files/yHYLUbv0VrSqFbxAUL91)\
It contains two action maps: UI and Gameplay

#### UI Action Map

This action map contains default UI actions like click and navigate, as well as two custom actions:&#x20;

* Settings - this action is responsible for opening settings window in main menu and for opening pause window during gameplay.&#x20;

  <figure><img src="/files/eFbmWYXJhE6K3uANGrts" alt=""><figcaption><p>Settings action bindings</p></figcaption></figure>
* Back - this action map is responsible for closing main menu windows and pause window in during gameplay.

  <figure><img src="/files/XkHa7oDQf2MlvoSB5bt1" alt=""><figcaption><p>Back action bindings</p></figcaption></figure>

#### Gameplay Action Map

This action map contains only one action - Movement. It is responsible for the movement of the character during gameplay.

<figure><img src="/files/aT8rWIapnIJnJramVUah" alt=""><figcaption><p>Movement action bindings</p></figcaption></figure>

You can add additional bindings to the actions above to accommodate for more specific devices.

### Input Manager

Input Manager manages switching between different input types, provides access to the [Input Asset](/monster-survivors-documentation/input/input-system.md#input-asset) and controlls the visibility of UI Joystick and Button Highlights.

```csharp
public class InputManager : MonoBehaviour
{
///...
    // This value shows the currently active input type (UIJoystick, Keyboard, Gamepad)
    public InputType ActiveInput { get => save.ActiveInput; private set => save.ActiveInput = value; }
    
    // This value is used for calculating movement of the player
    public Vector2 MovementValue { get; private set; }
    
    // This event fires every time the input type changes
    // First parameter is the previous input type
    // Second parameter is the new input type
    public event UnityAction<InputType, InputType> onInputChanged;
//...
}

// Use GameController.InputManager to get Input Manager from anywhere from the project
```
