Input (C++)
The IMC subclass and how the subsystem registers it on world match start, plus per-cheat hotkey binding.
The plugin defines its own IMC subclass and registers it on world
match start. Per-cheat hotkeys reuse standard UInputAction assets
through each cheat script's InputAction property.
UBlueprintCheatsInputMappingContext
- Header:
Source/BlueprintCheats/Public/Input/BlueprintCheatsInputMappingContext.h
UCLASS()
class BLUEPRINTCHEATS_API UBlueprintCheatsInputMappingContext : public UInputMappingContext
{
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly, Category="Bindings")
TSoftObjectPtr<UInputAction> MenuHotkey;
};MenuHotkey
The input action that opens / closes the cheat overlay. The subsystem
binds this on ETriggerEvent::Triggered:
InputComp->BindAction(InputContext->MenuHotkey.Get(),
ETriggerEvent::Triggered,
this,
&UBlueprintCheatsSubsystem::OnMenuKeyTriggered);The shipped default IMC is
/BlueprintCheats/Input/IMC_BlueprintCheats_Default with
IA_BlueprintCheats_Menu as its MenuHotkey. Configure your own IMC
by creating a Blueprint Cheats Input Mapping Context asset and
pointing UBlueprintCheatsSettings::InputMappingContext at it.
How the IMC is registered
In UBlueprintCheatsSubsystem::OnWorldMatchStarted:
#if !PLATFORM_MOBILE
if (UEnhancedInputComponent* InputComp = Cast<UEnhancedInputComponent>(PlayerController->InputComponent))
{
if (UBlueprintCheatsInputMappingContext* InputContext = Settings->InputMappingContext.LoadSynchronous())
{
InputSubsystem->AddMappingContext(InputContext, /*Priority*/ 0);
InputComp->BindAction(InputContext->MenuHotkey.Get(),
ETriggerEvent::Triggered,
this,
&UBlueprintCheatsSubsystem::OnMenuKeyTriggered);
}
}
#endifThis happens once per world match start, scoped to the local player's controller. The mobile gate skips the bind entirely.
Per-cheat hotkeys
UBlueprintCheatScript::InputAction is the per-cheat hotkey field.
Bound by UBlueprintCheatsSubsystem::EnableScript_Internal:
if (TObjectPtr<UInputAction> ScriptAction = CurrentScript->GetInputAction())
{
InputComp->BindAction(ScriptAction, ETriggerEvent::Triggered, this,
&UBlueprintCheatsSubsystem::OnInputTriggeredScript, ScriptIndex);
if (CurrentScript->ContinueExecutingWithOngoingKeyPress())
{
InputComp->BindAction(ScriptAction, ETriggerEvent::Ongoing, this,
&UBlueprintCheatsSubsystem::OnInputTriggeredScript, ScriptIndex);
}
}OnInputTriggeredScript calls ExecuteScriptFromConsole with an
empty TArray<FString>. Cheats meant for hotkeys must therefore
either declare zero arguments, or default every argument
(TOptional<T> DefaultValue populated, or bOptional = true).
GetInputAction is virtual on UBlueprintCheatScript. Override it
to vary the bound action at runtime (e.g. swapping per platform).
Mobile
PLATFORM_MOBILE (iOS / Android) skips both:
- the menu IMC registration and
MenuHotkeybind, and - per-cheat
InputActionbinds.
Console commands and UBlueprintCheatsSubsystem::ExecuteScript still
work on mobile. To surface the overlay on mobile, build a custom
trigger (debug button, gesture, etc.) and call into the subsystem
directly.
Sample assets
IA_BlueprintCheats_Menu— toggles the overlay.IA_BlueprintCheats_ResetLevel— example per-cheat hotkey.IMC_BlueprintCheats_Default— wires both actions to default keys.
Located under /BlueprintCheats/Input/.