Download

C++ Delegate won't show up as Event in Blueprint for Component

Hi,

I want a custom component (derived from UStaticMeshComponent) to have an event it can trigger.
For that I declare a delegate


DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnTriggerDelegateC);

and use it in my class


UPROPERTY(BlueprintAssignable, Category = "Trigger")
		FOnTriggerDelegateC OnTrigger;

When instantiating this class in my Actor-Blueprint I can Bind stuff to this event, but I don’t find the event-node itself (which should fire when this event is broadcasted from C++).

To the contrary, if I do the same thing in an actor class and try to do the same thing in the level-blueprint it shows up and works as expected.

Why won’t it work with my custom component inside my Actor-blueprint ? I don’t get it ? Is it a missing feature or do I do something wrong here ?

bump.
Nobody ever experienced this ? :confused:

Events aren’t delegates, they are functions.

Example:



UFUNCTION(BlueprintNativeEvent, Category = "MyEvents")
void OnDoSomething();
void OnDoSomething_Implementation();


This will make one of those red nodes that you can fire from C++. If you want to be able to fire it from BP too, add ‘BlueprintCallable’. You should create void AMyClass::OnDoSomething_Implementation() in the .cpp file.

If you add code to the cpp file, you can rightclick the red event node in Blueprint, and use ‘Add Call To Parent Function’ to call the C++ code as well as your BP code.

@TheJamsh I have been trying to do exactly that and I can’t seem to override the function from the component. Any ideas?
I realize this is a really old post, but it is exactly what I am trying to do.

I am trying to have a
BlueprintNativeEvent
declared within a UStaticMeshComponent inheriting class that I am hoping to be able to override on any actor blueprint I add the component to.

The idea is to have a few components in one actor each doing slightly different things based on the BlueprintNativeEvent functions I override in the blueprint. Is that possible at all?

Thank you for your time,
-Luis

You can’t override a components’ function in an Actor blueprint no. You can create Multi/Single-cast dynamic delegates - and Single-Cast delegates can have return values.

If you want to override a Component function you need to first create a Blueprint of the Component and override it there, then add that blueprinted component to your actor. If you find yourself needing to do that though and change it for every actor it’s used on, then the function should probably be a member of the actor instead.