How do I access input actions from Enhanced Input?

The following code in my SurvivalCharacter class returns an Undefined error for IA_Jump.

Input->BindAction(IA_Jump, ETriggerEvent::Triggered, this, &ASurvivalCharacter::InputCallbackFunc);

I essentially just copied the code from the documentation. I have already included “InputMappingContext.h” in my header file, but I am unsure what else I need to include access the input actions. Sorry if this is a stupid question, as I am fairly new to C++.

BUMP. I still don’t know how to use the BindAction function.

The easiest way would be to have a UInputAction* UPROPERTY that you assign using a blueprint that is inherited from your C++ class. You can also use ConstructorHelpers::FObjectFinder to get a reference to your input actions if you want to do it solely in C++.

2 Likes