Why can't I tag a delegate created with DECLARE_EVENT as a UPROPERTY

I have a class I want to add some Events to that are exposed to Blueprints. It looks something like this:

UCLASS(Blueprintable, BlueprintType)
class MONSTERHOCKEY_API APeriodManager : public AInfo


	DECLARE_EVENT(APeriodManager, FPeriodClockPausedDelegate)
	UPROPERTY(BlueprintAssignable, Category = "Period Manager Events")
	FPeriodClockPausedDelegate onPeriodClockPausedDelegate;     <--- line 54

I trimmed out all the irrelevant stuff. There’s a forum thread I was using as an example. I also tried the example in the docs.

They both produce the same compiler error:

2> C:/Coding/UE4/MonsterHockey/Source/MonsterHockey/PeriodManager.h(54) : Unrecognized type ‘FPeriodClockPausedDelegate’ - type must be a UCLASS, USTRUCT or UENUM

If I comment out the UPROPERTY line, it compiles, but then I can’t do anything with it from Blueprint land, as far as I’m aware.

Trying to use DECLARE_MULTICAST_DELEGATE instead produced the same result.

What am I doing wrong here?

1 Like

If you would like to expose a delegate as a UProperty, you must declare a dynamic delegate instead of a regular one. The macros are similar: DECLARE_DYNAMIC_DELEGATE, DECLARE_DYNAMIC_MULTICAST_DELEGATE, etc. I don’t believe events can be exposed as UProperties, but you can accomplish the same thing with delegates (events are just delegates with a restriction on the class which is allowed to broadcast the execution).

You can take a look at some documentation for dynamic delegates here: Dynamic Delegates in Unreal Engine | Unreal Engine 5.1 Documentation

1 Like