How to bind event to event dispatcher without cast

Hello everyone,
I’m learning event dispatcher and found the issue, I can’t bind an event to the event dispatcher.
In the BP_Player3 I made a simple event dispatcher call on 0 HP and then in the widget I’m binding event to react on this but I don’t like the idea to use a cast.


I tried to send actor reference via BP interface, but it doesn’t work

Is there a way to get access to the event dispatcher without using a cast?

1 Like

Nope, the cast is fine. If you don’t want to cast all the time you can do it on beginplay and set to a BP_Player3 reference variable you can use in your Blueprint. Without the cast, it won’t know how to reach EDPlayerDeath.

3 Likes

This is correct. But… When storing a reference to the character for a later moment you will probably want to check for its validity anyway when that moment arrives, at which point you’d either use the Cast node or the IsValid node anyway.

Specialized Actor logic is usually implemented in ActorComponents (Yes, also a Health system), which you can glue to any type of actor (and character). Saves a cast node and makes the system more re-usable.

4 Likes