I too am trying to add the Enhanced Input via the Controller instead the Character (to allow that segregation).
Thanks @Rogue_Programmer for the help in solving the issue instead of a workaround!
Following your solution I couldn’t find in the base classes where ‘StartFire’, 'SafeRetryClientRestart ', and ‘OnPossess’, should be using ‘SetupPlayerInputComponent’, so I couldn’t follow the example.
Would love to know where I missed them
BUT I did manage to make my inputs work just the way you are trying @Thalamus01.
Any chance (just like @Rogue_Programmer suggested), that you accidently didn’t set up the Mapping and Input in the Controller’s Blueprint?
This is my code in the controller:
void ATantrumPlayerController::BeginPlay()
{
Super::BeginPlay();
if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
{
Subsystem->AddMappingContext(MappingContext, 0);
}
}
void ATantrumPlayerController::SetupInputComponent()
{
Super::SetupInputComponent();
UEnhancedInputComponent* Input = Cast<UEnhancedInputComponent>(InputComponent);
Input->BindAction(JumpAction, ETriggerEvent::Triggered, this, &ATantrumPlayerController::RequestJumpAction);
Input->BindAction(LookAction, ETriggerEvent::Triggered, this, &ATantrumPlayerController::RequestLookAction);
Input->BindAction(MoveAction, ETriggerEvent::Triggered, this, &ATantrumPlayerController::RequestMoveAction);
}
And this is the Controller’s Blueprint inputs:
If it still doesn’t work please let us know, I would love to try and help further!
Edit: wanted to add that I’m using UE5.4, don’t know if that’s related in any way, but thought I’d mention it