Keyboard event in C++

Is there an analogue of “keyboard event” in C++? I need to check the button click in animinstance. I can’t find anything like that.

You can make a two new bindings in your PlayerController for InputComponent to check if your button pressed or released and a bool variable: if pressed, set it true, if not - false. After it, just access this variable (get player controller) from your AnimInstance.

Thanks for your reply. Could you help me a little more? The fact is that I am not very good at accessing a variable from C++ class Character to C++ class AnimInstance. Could you describe it in more detail, please.

Sure. UAnimInstance has a function TryGetPawnOwner(), which returns APawn pointer - object, which owns this UAnimInstance. APawn has a function GetController - get a pointer to controller of this pawn. If you use UAnimInstance at your player character, using TryGetPawnOwner()->GetController() will return PlayerController. After that, just access variable from controller.

void UYourAnimInstance::NativeInitializeAnimation() {
    APawn* ControlledPawn = TryGetPawnOwner() // get owner pawn
    if(ControlledPawn){ //check if ControlledPawn != nullptr
        Controller = Cast<AYourControllerType>(ControlledPawn->GetController()) //get controller, cast it to your controller type and save to UYourAnimInstance member of type AYourControllerType*

void UYourAnimInstance::NativeUpdateAnimation(float DeltaSeconds) {
    if(Controller){ // if Controller valid
        bool Data = Controller->Data; // get a variable from controller

It’s just an example, maybe there is a better way to access variables in PlayerController from AnimInstance.

Thank you very much, you helped me a lot.