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:
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?
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.