I can't call the Enhanced Input System in C++

Hi, I’m trying to add the Enhanced Input System to my code, but I’m having a problem.

I can call the functions necessary in Blueprints because it appears in the context browser, but when I try adding the necessary code to set up the process in C++ nothing appears.

I’m trying to add the following in the BeginPlay() function:
`
void ARobotCharacter::BeginPlay()
{
Super::BeginPlay();

if (APlayerController* PlayerController = Cast<APlayerController>(GetController())
	if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PlayerController))
		Sybsystem->AddMappingContext(MC_Controller, 0);

}
`
The error I’m encountering is that for some reason I can’t call the UEnhancedInputLocalPlayerSubsystem class or its functions.

Note: MC_Controller is my own mapping context

hi @MataLaCucaracha

I do not know if your code is correct, only i do see what looks like a typing error near the end of your code

Could you post the errors?

Don’t forget to add the Enhanced Input module in your ProjectName.Build.cs:

PublicDependencyModuleNames.AddRange(new string[] { "EnhancedInput" });

References > Module:
https://docs.unrealengine.com/4.26/en-US/API/Plugins/EnhancedInput/UEnhancedInputLocalPlayerSubsyst-/

Thanks for the help. I recently had the same issue again but this time is because I forgot to include the header XD. But thanks, forgot to mark it as the solution.