Skip to content

Input Manager Component

The Input Manager Component is the core of this plugin and is responsible to bridge Actions issued by the Enhanced Input System to any registered Input Handlers.

As we covered in the Plugin Overview, an Input Handler is an object responsible for handling a given Action, with a given Trigger. We'll explore more about these objects in the next section as these are the pieces of the system we'll be dealing with the most.

However, it's important to understand what the Manager Component does, when and for/what it can be called and how to customize it, if necessary.

Component Initialization

During initialization, the Component will bind itself the Enhanced Input Subsystem and load any Input Contexts that were provided by default, also caching any handlers that are available.

You don't need to worry about initializing (or re-initializing) the component, as it will bind itself to relevant lifecycle events and deal with any pawn restarts automatically.

Just make sure to assign the component properly, as shown in the Initial Setup!


The system was designed with the Command and Chain of Responsibility OOP Design Patterns in mind. To accomplish that, there are three types of objects provided by the system, that are used in conjunction to implement that design and therefore, handling input.

Input Manager Component

An UActorComponent added to any actor receiving input values from the Enhanced Input System. It acts as a bridge between Inputs the Enhanced Input System and any Input Handler registered to the component.

This Component also provides functions that can be used in runtime to add/remove UInputMappingContext Data Asset, along with any meaningful Input Handlers.

        Enhanced Input->>Manager: input action triggered
        activate Manager
        loop Find Handler
            Manager->>Handler: can handle input?
            Handler-->>Manager: yes
            Manager->>Handler: handle input
            activate Handler
            Handler->>Handler: handle input event
            deactivate Handler
        deactivate Manager

Input Setup

An UDataAsset that aggregates an Input Mapping Context with any Input Handlers. These can be created directly from the editor and must be added to the Input Manager Component.

Input Handler

These are granular UObjects, with a specific API, and are responsible for handling input. They are meant to be added to the Manager Component which will delegate input values as appropriate. They are meant to be connected with Input Actions.

Available Functions

Even though you can load multiple Input Mapping Contexts by default, at some points it may be relevant to add or remove contexts. For example, when you open an Inventory Window, it may be useful to remove the character's locomotion input context and add an UI navigation context, and revert that operation once the window is closed.

For that, the following functions are available.

Adding or Removing Setups

// ----------
// .h

    virtual void BeginPlay() override;
    virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;


    /** Loaded via defaults, maybe in constructor or from a subclass. */
    UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Input")
    TObjectPtr<UNinjaInputSetupDataAsset> SetupData;

// ----------
// .cpp
#include "NinjaInputManagerComponent.h"
#include "Data/NinjaInputSetupDataAsset.h"

void ANinjaPlayerCharacter::BeginPlay() 

void ANinjaPlayerCharacter::EndPlay(const EEndPlayReason::Type EndPlayReason) 
Duplicated Entries

The Manager Component will not register duplicates for the InputSetup and InputMappingContext. It will however allow duplicates of Input Handlers coming from different setups/mapping configurations.