I’m having an issue with the enhanced input system not working, pretty sure it’s just general ignorance.
I’ve created a custom controller that I want to use for commands, and then I created a camera for the game. The game doesn’t respond to the controls I set up for it though, it only responds to the controls I created for the controller.
I tried this on the camera:
void ACameraPlayer::BeginPlay()
{
Super::BeginPlay();
AGameController* PlayerController = Cast<AGameController>(Controller);
if (PlayerController)
{
UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PlayerController->GetLocalPlayer());
if (Subsystem)
{
Subsystem->AddMappingContext(CRPGMapContext, 0);
}
}
This is what is on the Game Controller:
void AGameController::BeginPlay() {
Super::BeginPlay();
bShowMouseCursor = true;
if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
{
Subsystem->AddMappingContext(CRPGMapContext, 0);
}
}
Maybe I’m overthinking things and should just use the camera I built to handle everything, but even if that is the case, how would I go about setting up different input commands between different scripts?