Hi, I’m trying to create input bindings using the enhanced input system, the only difference is that I’m doing that directly in the character’s controller class instead of the player character itself.
Reference
In the image above, the classes like “move and look” are created in the character, and I want to call them in the player controller class using the enhanced input system
I’ve done something similar to this but it was directly in the player character class which I don’t want to do this time as it’ll be quite big, so I’m trying to call them directly in the controller class but I’m having issues as I haven’t done something similar before and it gives me an error which I can’t seem to get rid of or find a solution to.
MainCharacterController.h
Uclass()
class TestLooter_API AMainCharacterController : public APlayerController{
public:
virtual void SetupInputComponent(class UInputComponent* PlayerInputComponent) override;
...
};
MainCharacterController.cpp
...
void AMainCharacterController::SetupInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupInputComponent(PlayerInputComponent);
if (UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(PlayerInputComponent))
{
//Axis
EnhancedInputComponent->BindAction(IA_Move, ETriggerEvent::Triggered, this, &AMainCharacterController::CallMove);
EnhancedInputComponent->BindAction(IA_Look, ETriggerEvent::Triggered, this, &AMainCharacterController::CallLook);
//Actions
EnhancedInputComponent->BindAction(IA_Jump, ETriggerEvent::Triggered, this, &AMainCharacterController::CallJump);
EnhancedInputComponent->BindAction(IA_Interact, ETriggerEvent::Triggered, this, &AMainCharacterController::CallInteract);
}
...
Here’s an image of what appears in my IDE after I try to use the Enhanced Input Component: