RealDocs

APawn::GetOverrideInputComponentClass

function Engine Blueprint Since 5.1
#include "GameFramework/Pawn.h"
Access: public Specifiers: UFUNCTIONBlueprintCallableconst

Description

Returns the InputComponent subclass that should be created for this pawn instead of the project's default, as set by the OverrideInputComponentClass property. Returns null if no override is set.

Caveats & Gotchas

  • This is the accessor for the protected OverrideInputComponentClass UPROPERTY. The class itself is set in the pawn's Blueprint defaults or constructor via OverrideInputComponentClass = MyInputComponentClass::StaticClass().
  • Used primarily to support Enhanced Input — set OverrideInputComponentClass to UEnhancedInputComponent::StaticClass() on your pawn to ensure Enhanced Input bindings are used regardless of the project default.

Signature

TSubclassOf<UInputComponent> GetOverrideInputComponentClass() const;

Return Type

TSubclassOf<UInputComponent>

Example

Force Enhanced Input component class C++
AMyPawn::AMyPawn()
{
	// Ensure this pawn always uses Enhanced Input, regardless of project settings
	OverrideInputComponentClass = UEnhancedInputComponent::StaticClass();
}

// Later, verify the override is set correctly:
void AMyPawn::BeginPlay()
{
	Super::BeginPlay();
	UE_LOG(LogTemp, Log, TEXT("Input component class: %s"),
		*GetOverrideInputComponentClass()->GetName());
}

Version History

Introduced in: 5.1

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.