Event from level blue print to actor

I want to create an event dispacher in my level blue print.
and bind to it from an actor blueprint.
I can’t find a way to get a reference to the event I created at my Level blueprint.
Any idea how to do that?
Thanks!

Is the actor in the scene already?

@Everynone yes.

Since both the actor and the dispatcher are in the LB:

  • create a Custom Event (or function) in the actor (ensure a matching signature):

image

  • reference that actor in the LB and register it with the LB’s dispatcher:

Whenever the dispatcher is called, the actor will fire its event.

1 Like

@Everynone thank you so much for the suggestion, but it does not seem to work quite the same for me. here is what I got.

(apparently new users can only post one image at a time, so I’m splitting in two parts)
and I think it’s not the set up I am looking for.
If I could diagram what I am looking to do it would be something like this image below.
this way I can have 1 or 100 interactiveBall actors and would not need to change anything, right? if I am not mistaken with the suggestion above I would need to reference and bind the event on every new interactiveBall, correct?

You said you have an Event Dispatcher in the LB yet you are not calling it:

This is how you’d call it:


Sadly, no such thing exists.

Sorry that part I have, here is the img
The part I am struggling is to figurering out how to Bind to it from the actor blueprint.

image

This is done in the Level Blueprint. Providing the dispatcher is in the LB, right click the graph and search for the name of the dispatcher.


Do note that this does not need to be done in the LB. It can be done in almost any actor apart from the InteractiveBall. But then the referencing would need to be done differently.

You have options:

Filter actors (there are many ways) and bind them all:

Press 1 in the LB, all Interactive Balls will execute their custom events.


Create a new Ball Manager actor and:

  • plop it in the LB
  • or spawn it after the Interactive Balls
  • and/or have the manager spawn the balls - the easiest way to reference, btw

This manager can register stuff in the same way as above or…

…since we’re no longer using LB for scripting (yay!) - we have a managing actor - we can actually have the Interactive Balls reach out and ask to be registered instead. Similar to what you suggested here:

But instead of the LB, we have a Ball Manager. In this case:

  • the manager has a dispatcher:

image

  • any actor that wishes to be affected can now:

  • alternatively, dynamically spawned actors can be registered on the go:


You were stuck because one cannot cast to the LB. Ideally avoid scripting there and rely on actors instead. If you had 50 levels, you probably wouldn’t like to repeat the same script again and again. It’s much more convenient to have an actor and drop it in the level.

Also, there is the entire concept of framework classes - player controller, game mode, pawn, game instance and so on. They are absolutely capable of performing a role of such manager. And they’re accessible from pretty much anywhere via a single cast.