Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Product Version: UE 4.10
more ▼

asked Jan 08 '16 at 07:21 PM in C++ Programming

avatar image

22 6 7 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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: https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Delegates/Dynamic/index.html

more ▼

answered Jan 09 '16 at 03:28 AM

avatar image

2.4k 101 72 124

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question