Can a blueprint actor "hear" a C++ function firing in its components?

I’m working on an item system, 99% of it takes place in C++ but I’m trying to use blueprint to create “holder” actors whose job is to retain a reference to my item struct until the player interacts with them and takes the item they’re storing, at which point the actor itself needs to self-destruct (so it can’t be looted again).

I wrote an actor component which actually holds the item data and does all the heavy lifting to figure out if it can be looted, and gave it what I thought were two events that blueprint could see and subscribe to, the idea being that my C++ logic would detect when it needed to destroy itself, and fire an event to inform its actor of this fact:


UFUNCTION(Category = "Interaction", BlueprintImplementableEvent)
		void PickedUp();

		UFUNCTION(Category = "Interaction", BlueprintImplementableEvent)
		void NotPickedUp();

However, when I get a reference to my component in blueprint I can’t see either of these events, even with the context sensitive turned off. Is there something I neglected to place in the UFUNCTION macro, or am I going about this in a fundamentally wrong way?

I do this from the pawn and it works:



UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "MMT Physics Tick"), Category = "MMT physics sub-stepping")
void MMTPhysicsTick(float SubstepDeltaTime);


Have you tried to find this event in the blueprint of the component itself instead of trying to call it from a reference to component?

Hmm that’s weird, I copied & pasted directly from your example and it still won’t show up, so it’s definitely something funny that I’m doing. Per your second question, and probably directly related to the problem, I don’t actually have a blueprint of the component; it’s a C++ component that I mark as a BlueprintSpawnableComponent in its UCLASS macro, but if I right-click on it in the content browser “Create blueprint class based on…” is greyed out for every class of type UActorComponent.

That being the case, I just made an actor BP and added my class through the Add Component tab. It works fine and everything, it just can’t actually see the implementable events I’m adding.

Perhaps your c++ component have to be marked as blueprintable for your event to be blueprint implementable. Unfortunately I don’t have any macro example for blueprintable component, but source of ActorComponent or SceneComponent should have such macro.

Hmm okay, thank you :slight_smile:

One thing, code of the event that I have is declared in custom Pawn, not in custom component.

Yeap, I forgot about this:

mechanism for components is different!