跳到正文
cccskills
免费在 GitHub 公开

unreal-enhanced-input

Set up movement, camera look, jump, and other player controls with Unreal Engine 5 Enhanced Input. Create action assets and key mappings, adjust input values and activation conditions, and connect events to C++ or Blueprint handlers.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Set up player input in Unreal Engine 5 with Enhanced Input: Input Actions, Input Mapping Contexts, modifiers and triggers, adding the mapping context, and binding actions by ETriggerEvent. Use when wiring movement/look/jump input, creating IA_/IMC_ assets, binding in C++ or Blueprints, or when the user mentions Enhanced Input, Input Mapping Context, Input Action, IA_/IMC_, or ETriggerEvent.

实测评分 未实测

查看安装方法

适用场景

  • Adding movement, camera look, and jump controls
  • Mapping WASD keys to two-dimensional movement
  • Configuring press, hold, and release behavior
  • Debugging missing input or conflicting mappings

包含的文件(2)

  • SKILL.md6.5 KB
  • references/cpp-setup.md4.7 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Unreal Enhanced Input

Wire player input the modern UE5 way with the Enhanced Input system: data-driven Input Actions and Mapping Contexts instead of the legacy Project Settings axis/action mappings. Targets UE 5.8 (Enhanced Input is the default; legacy input is deprecated).

When to use

  • Use when adding movement/look/jump/fire input, creating Input Action (IA_) and Input Mapping Context (IMC_) assets, applying modifiers/triggers, adding a mapping context to a player, or binding actions in C++ or Blueprints.
  • Use when the project has IA_*/IMC_* assets or references EnhancedInput.

When not to use: engine-agnostic input architecture (rebinding strategy, buffering, multi-device design) → input-systems. The Pawn/Character C++ those bindings live in → unreal-cpp-gameplay.

Core workflow

  1. Enable the module/plugin. Enhanced Input is on by default in UE5; for C++ binding add "EnhancedInput" to PublicDependencyModuleNames in *.Build.cs.
  2. Create Input Actions (IA_). Each has a Value Type: Digital (bool) for buttons, Axis1D (float) for triggers, Axis2D (Vector2D) for movement/look.
  3. Create an Input Mapping Context (IMC_) that maps keys/buttons to those actions. Use Modifiers to shape raw input (Negate, Swizzle Input Axis Values, Dead Zone) — e.g. WASD into one Axis2D needs Negate on A/S and a Swizzle on W/S. Use Triggers (Pressed, Hold, Tap) to decide when an action fires. The Combo trigger is deprecated in UE 5.8; don't build new input on it.
  4. Add the mapping context to the player via the EnhancedInputLocalPlayerSubsystem (AddMappingContext(IMC, Priority)), usually in BeginPlay/possession.
  5. Bind actions to handlers by ETriggerEvent (Triggered, Started, Completed, …) on the EnhancedInputComponent, and read the FInputActionValue in the handler.
  6. Verify in PIE; the Enhanced Input debugging console commands (showdebug enhancedinput) show which actions trigger and their values.

Patterns

1. Add the mapping context (C++ Character)

void AMyCharacter::BeginPlay()
{
    Super::BeginPlay();
    if (APlayerController* PC = Cast<APlayerController>(GetController()))
        if (ULocalPlayer* LP = PC->GetLocalPlayer())
            if (auto* Subsystem = LP->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>())
                Subsystem->AddMappingContext(DefaultMappingContext, /*Priority*/ 0);
}
// DefaultMappingContext is a UPROPERTY(EditAnywhere) TObjectPtr<UInputMappingContext>.

2. Bind actions and read values

void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
    Super::SetupPlayerInputComponent(PlayerInputComponent);

    // The component is an Enhanced Input component when the plugin is active.
    // (Don't name the parameter InputComponent: that shadows AActor::InputComponent.)
    if (UEnhancedInputComponent* EIC = Cast<UEnhancedInputComponent>(PlayerInputComponent))
    {
        EIC->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AMyCharacter::Move);
        EIC->BindAction(LookAction, ETriggerEvent::Triggered, this, &AMyCharacter::Look);
        EIC->BindAction(JumpAction, ETriggerEvent::Started,   this, &ACharacter::Jump);
        EIC->BindAction(JumpAction, ETriggerEvent::Completed, this, &ACharacter::StopJumping);
    }
}

void AMyCharacter::Move(const FInputActionValue& Value)
{
    const FVector2D Axis = Value.Get<FVector2D>();          // Axis2D action
    AddMovementInput(GetActorForwardVector(), Axis.Y);
    AddMovementInput(GetActorRightVector(),   Axis.X);
}

3. Blueprint equivalent (node flow)

Event BeginPlay
  -> Get Controller -> Cast To PlayerController -> Get Local Player
  -> Get EnhancedInputLocalPlayerSubsystem -> Add Mapping Context (IMC_Default, Priority 0)

// IA_Move is exposed as its own event node in the Character's Event Graph:
EnhancedInputAction IA_Move (Triggered)
  -> Action Value (Vector2D) -> Add Movement Input (Forward * Y, Right * X)

Pitfalls

  • No input at all — the mapping context was never added (AddMappingContext), or the player has no Local Player yet. Add it after possession/BeginPlay.
  • Input works in single player but not on a client, or stops after respawn — BeginPlay ran before the controller possessed the pawn, so GetController() was null. Add the context in an override of PawnClientRestart(), which runs on the owning client after possession (Epic's Input Overview does this), or in the PlayerController.
  • Link/compile error binding in C++ — "EnhancedInput" isn't in Build.cs PublicDependencyModuleNames.
  • WASD only moves on two keys / wrong axis — Axis2D needs Modifiers: Negate on the negative keys (A, S) and a Swizzle Input Axis Values on the vertical (W/S) so both axes map correctly. Raw bindings without modifiers misbehave.
  • Get<FVector2D>() returns zero — value-type mismatch: the Input Action is Digital/Axis1D, not Axis2D. Match the Get<T>() to the action's Value Type.
  • Action fires every frame unexpectedly — Triggered repeats while held for a Down trigger; use Started/Completed for one-shots (jump press/release), or a Pressed/Tap trigger.
  • Two contexts fight — multiple mapping contexts stack by Priority; a higher-priority context can consume a key. Manage with priorities and RemoveMappingContext.

References

  • For a complete first-/third-person C++ Character with Enhanced Input (header + source, including look/jump and a control-rebind note), read references/cpp-setup.md.
  • Primary docs: "Enhanced Input in Unreal Engine" (https://dev.epicgames.com/documentation/en-us/unreal-engine/enhanced-input-in-unreal-engine) and "Input Overview" (https://dev.epicgames.com/documentation/en-us/unreal-engine/input-overview-in-unreal-engine).

Related skills

  • input-systems — engine-agnostic input architecture and rebinding strategy.
  • unreal-cpp-gameplay — the Character/Pawn class and module setup.
  • fps-shooter — composes input with a 3D controller and shooting.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Implement reusable decision systems for game characters using behavior trees, which organize conditional actions, and Utility AI, which scores available choices. Build either approach or combine them to control patrols, combat, targeting, and needs-based behavior.

中文简介正在准备中。当前显示英语简介。

  • Build a reusable behavior tree runtime
  • Choose attacks or targets using action scores
  • Combine patrol and combat trees with Utility AI
gamedev-skills/awesome-gamedev-agent-skills38262026年10月24日 更新

Design game audio with grouped volume controls, music that responds to gameplay, and varied sound effects. Plan how music lowers during dialogue and how events follow the beat, using principles that can be adapted to different game engines.

中文简介正在准备中。当前显示英语简介。

  • Plan grouped volume controls for music, effects, and dialogue
  • Lower background music while dialogue plays
  • Change music layers or segments with gameplay intensity
gamedev-skills/awesome-gamedev-agent-skills38262026年10月24日 更新

bevy-ecs

免费

Build and debug Rust games in Bevy using ECS, a way to separate game data from behavior. Organize apps and plugins, query entities, control execution order, and fix conflicting data access or frame-dependent movement.

中文简介正在准备中。当前显示英语简介。

  • Organizing a Bevy app with plugins
  • Defining components and shared resources
  • Fixing conflicting queries and execution order
gamedev-skills/awesome-gamedev-agent-skills38262026年10月24日 更新

Build and tune game cameras for smooth 2D following and 3D viewing. Covers motion smoothing, look-ahead, level boundaries, wall avoidance, and framing multiple targets, with techniques that apply across engines.

中文简介正在准备中。当前显示英语简介。

  • Smooth player-follow cameras in 2D games
  • Keep the camera view within level boundaries
  • Prevent third-person cameras from clipping through walls
gamedev-skills/awesome-gamedev-agent-skills38262026年10月24日 更新

card-game

免费

Design the core rules of a card game, including decks, hands, discards, drawing, shuffling, turns, and resource costs. Represent card effects as data and define their resolution order so card movement and gameplay outcomes follow explicit rules.

中文简介正在准备中。当前显示英语简介。

  • Building a deckbuilder or trading card game
  • Implementing draws and discard reshuffling
  • Defining turn phases and card costs
gamedev-skills/awesome-gamedev-agent-skills38262026年10月24日 更新

Plan and prepare consistent game artwork, from sprites and backgrounds to UI icons and 3D briefs. Organize asset requirements, generate or source related visuals, standardize files, and check their appearance and technical fit inside the game.

中文简介正在准备中。当前显示英语简介。

  • Create sprites and backgrounds with a consistent visual style
  • Check asset dimensions, transparency, and tile seams
  • Track asset sources and licenses before release
gamedev-skills/awesome-gamedev-agent-skills38262026年10月24日 更新

查看 gamedev-skills 的全部技能

报告此技能的问题