Exposing Event

Hello. Declared and/or derived event is an undefined type for UHT so it cannot be used for UFUNCTION and UPROPERTY. Is there (or ever will be) possibility to expose events to Blueprint (for example in this way, look at the comments)?

Hey ErgoAsh-

What exactly do you mean by “delcare and /or derived events”? If you are referring to the red event nodes, you can add these through C++ by declaring your UFUNCTION as either BlueprintImplementableEvent or BlueprintNativeEvent. A BlueprintImplementableEvent does not contain any default code and is meant to be overridden by the blueprint. A BlueprintNativeEvent can be overridden by the blueprint, but also includes native code that is defined in the source file with < FunctionName >_Implementation() and is called when the function is not overridden by the blueprint.

Cheers

That’s an interesting approach but the problem is that I have to use delegates.

I have created an event in interface:

DECLARE_EVENT_OneParam(IAction, FExecuteEvent, ABaseCharacter*)
virtual FExecuteEvent& OnExecute() = 0;

But unfortunately there is no way to use it in Blueprint (FExecuteEvent is undefined for UFUNCTION).

I have also tried Multicast Delegate but the console output directly tells me that this is not supported by Blueprint (may I know why?).

A solution that would work in this case would be to create a separate UFUNCTION(BlueprintImplementableEvent) function. When your delegate gets called in the code, you can pass a call to the UFUNCTION event as well.