Ninja Bear Studio Plugins Help

Input Management

The Input System was designed to cleanly separate player input logic from Pawn or Character classes. By doing so, it promotes separation of concerns and reusability of such logic, even across different projects.

Input Manager Component

The Input Manager is the backbone of the Input System. It's responsible for initializing and maintaining Input Setups and routing Input Actions to appropriate Input Handlers.

The following functions are accessible to any Input Handler or external callers.

Function

Category

Description

ShouldProcessInputs

General

Informs if this Input Manager is currently processing inputs.

EnableInputProcessing

General

Globally enables input processing.

DisableInputProcessing

General

Globally disables input processing.

IsUsingKeyboardAndMouse

Context

Informs if the player's input device is the keyboard and mouse.

GetForwardVector

Context

Provides the forward vector, based on the Pawn or Forward Reference.

GetRightVector

Context

Provides the right vector, based on the Pawn or Forward Reference.

GetLastInputVector

Context

Provides the last input vector handled by the owner, via Pawn Movement Component or LastInputVectorProviderInterface.

GetPawn

Context

Provides the Pawn related to this component.

GetController

Context

Provides the Controller related to this component.

IsLocallyControlled

Context

Informs if the player is locally controlled.

GetAbilitySystemComponent

Context

Provides the Ability System Component related to the current Pawn.

HasSetupData

Setup Data

Checks if a given Setup Data is assigned to the component.

HasCompatibleInputHandler

Setup Data

Checks if there is an Input Handler set for a given Input Action and Trigger Event.

AddInputSetupData

Setup Data

Processes a Setup Data, registering its Input Contexts and Handlers.

RemoveInputSetupData

Setup Data

Removes a Setup Data previously registered.

RotateControllerToMouseCursor

Utility

Rotates the current controller to the mouse location.

Default Input Setups

You can provide default input setups in two ways:

  • Default Properties: By setting them directly into the Input Manager, in its Defaults Panel. These are always added to any possessed pawn and cannot be removed.

  • Pawn Interface: The pawn possessed by the owning Controller can provide input setups via InputSetupProviderInterface. They will be removed when the pawn is unpossessed.

Providing Input Setups for each pawn is especially useful for games where players possess multiple Pawns with distinct input needs (e.g., vehicles, turrets, or UI-driven characters).

Implementing the Setup Provider Interface

  1. Make sure to set your Input Manager to the Player Controller.

  2. Add the InputSetupProviderInterface to the pawn that will provide specific Input Setups.

  3. Create an array of NinjaInputSetupDataAsset references, so you can add Input Setups relevant to the Pawn.

  4. Implement the GetInputSetups function, returning the array of setups

    Using the Input Provider Interface

    Header

    #pragma once #include "CoreMinimal.h" #include "GameFramework/Character.h" #include "Interfaces/InputSetupProviderInterface" #include "PluginLabsController.generated.h" class NinjaInputSetupDataAsset; UCLASS() class PLUGINLABS_API APluginLabsCharacter : public ACharacter, public IInputSetupProviderInterface { GENERATED_BODY() public: // -- Begin Input Setup Provider implementation virtual TArray<UNinjaInputSetupDataAsset*> GetInputSetups_Implementation() const override; // -- End Input Setup Provider implementation protected: UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Input Setup") TArray<UNinjaInputSetupDataAsset*> CharacterInputs; };

    Implementation

    #include "GameFramework/APluginLabsCharacter.h" #include "Data/NinjaInputSetupDataAsset.h" TArray<UNinjaInputSetupDataAsset*> APluginLabsCharacter::GetInputSetups_Implementation() const { return CharacterInputs; }

Input Mapping Settings

When adding an input mapping, you may need to provide additional context options. In the Enhanced Input framework, this is handled by passing a FModifyContextOptions struct when adding your Input Mapping Context.

You can fine-tune the values in this struct—either globally or per mapping context—by overriding the CreateModifyContextOptions function in Blueprints or C++.

Runtime Management

Input Setups can be added and removed at runtime. This is useful when you want certain inputs to only become available when specific gameplay elements happen.

The Input Manager Component provides dedicated functions to add or remove Input Setups whenever necessary. It is important to ensure that any context you add is properly removed later to avoid unexpected behavior.

Input Setups can be added and removed using AddInputSetupData and RemoveInputSetupData.

Adding or Removing Setups
#include "Components/NinjaInputManagerComponent.h" #include "Data/NinjaInputSetupDataAsset.h" void ANinjaLabsItem::BeginPlay() { Super::BeginPlay(); GetOwnerInputManager()->AddInputSetupData(ItemSetupData); } void ANinjaLabsItem::EndPlay(const EEndPlayReason::Type EndPlayReason) { GetOwnerInputManager()->RemoveInputSetupData(ItemSetupData); Super::EndPlay(EndPlayReason); }

Global State

You can completely disable and enable input handling in an Input Manager. This can be useful during in-game cutscenes, when all input should be blocked without removing active Input Setups.

Globally Enable/Disable inputs
// Checks if the Input Manager is currently processing inputs. InputManager->ShouldProcessInputs() // Enables all input processing. InputManager->EnableInputProcessing() // Disables all input processing. InputManager->DisableInputProcessing()
Last modified: 28 August 2025