Simultaneous execution of the C++ code and Blueprint Event

Hello dear friends!
I mapped an action TakeGun and set it logic in Blueprints (fig. 1). But I also have a function TakeGun() in my C++ code (fig. 2). I noticed that the code written there is not executed when the functionality is already implemented in Blueprints. Is there any way to have both C++ code and Blueprint logic executed?

Thank you very much for your help in advance!


You have to call it explicitly.

If a C++ function is marked BlueprintNativeEvent, you can have a C++ implementation and also a blueprint override in the blueprint child classes. The blueprint child classes can call parent implementations via the “Parent” node.

image

Afaik an InputAction cannot inherit from a c++ function, but you can still mark your c++ function BlueprintCallable, and simply call it from blueprint.

Alternatively, if TakeGun is bound from C++ (via SetupPlayerInputComponent), you can probably still mark is as BlueprintNativeEvent. You’d just have to implement TakeGun_Implementation in c++, and in blueprints override TakeGun as a function rather than an InputAction. Then call parent.

Thank you very much for your answer. InputAction cannot inherit from a C++ function, so I marked the C++ function as BlueprintCallable and called it from the Blueprint.