Is there something like an event system in C++?

Hello,

I am currently working on a little C++ Item System. Now I want my Components to be able to react to event in the other components. For example, if I pick a an item of type weapon, I want to be able to react to this event, by attaching a listener to a certain event. Somewhat like events in javascript work or delegates in Unity.

Is there something similar to this in UE4 C++?

I think Delegates are what you are looking for: A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums

Function Pointers:

http://www.cprogramming.com/tutorial/function-pointers.html

This. More specifically: Multicast delegates.

Just no…

Yes. Delegates are just wrapped function pointers (;.

But that only if you want to go lower level possible with engine.

Delegates | Unreal Engine Documentation and iniside is right.

Multicast delegates are what you need yes, but I recently found a specialized version of that called Events which have further restrictions (only owner/containing class can call Broadcast). However, they don’t seem to be supported in Blueprints? :confused: I can hook up to multicast delegates just fine in BP, but cannot find a way to expose Events to a BP.

Use


UPROPERTY([BlueprintAssignable](https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/Properties/Specifiers/BlueprintAssignable/index.html))
FSomeDelegateName OnSomeDelgate;

Hi,

I just stumbled over this. Although this thread is somewhat older, I am wondering about the same: How can I call a delegate event from blueprint?
Unfortunately, I could not find anything about it on AnswerHub or in the Documenation. Alas, the term “event” is used somewhat misleadingly by Blueprints in this case, which doesn’t help. Does anybody know this?

Thanks in advance.