Can I override a C++ virtual void in a blueprint?

I am trying to override a function in ShooterPickup.h.

I want to make a pickup actor but not through overlap but using a key event.

I see in the ShooterPickup.h
/** pickup on touch /
virtual void ReceiveActorBeginOverlap(class AActor
Other) OVERRIDE;

Can I override this in a blueprint or do I need to write/change the this function in the C++ header file?

Hi Emile,

You can’t fully “override” it in a Blueprint in the strictest sense of the word, but you can add functionality to it by handling the event in your BP.

If you want to actually bypass the existing code in ShooterPickup, one workaround would be to subclass ShooterPickup in C++ and override it there, something like

void AMySpecialShooterPickup::ReceiveActorBeginOverlap(...)
{
   // skip the Super call and go straight to the Actor implementation
   AActor::ReceiveActorBeginOverlap(...);
}

The good news is we are working on some improvements to the system for overriding BlueprintImplementableEvents in either BPs or C++, which should be showing up in a build in the not-too-distant future.

Cheers!

  • Jeff

now that i look at the code closer if i do not want the pickup to be given during the overlap maybe I need to change the PickupOnTouch?
I am trying to make the item such as the health pickup have a use key in blueprints. but if i cannot disable the pickup happening when you touch the actor there then i see now I will have to make some changes at code level.

With the way it’s set up now, I agree. You’ll have to make some code changes to make that happen.

Jeff