Input System

The game uses Input System and allows seamlessly switching between different devices during any stage of gameplay.

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.

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: 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:

  • Settings - this action is responsible for opening settings window in main menu and for opening pause window during gameplay.

    Settings action bindings
  • Back - this action map is responsible for closing main menu windows and pause window in during gameplay.

    Back action bindings

Gameplay Action Map

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

Movement action bindings

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 and controlls the visibility of UI Joystick and Button Highlights.

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

Last updated