Call blueprint functions in the root world level

In our game we have a simple level (the root level) that streams in sub levels.
I want to call a function in the root level blueprint from a character actor (a player).
How does one get a handle on the top level level blueprint?

Working with the LB is somewhat awkward in certain scenarios. You have some options, none of them is exactly pretty in BPs.

Dispatch from the Player

  • if the player is in the level already, have it call a dispatcher:

The LB can catch that call and fire a custom event or a function in response.

The Dummy

Another option is to place a tagged dummy actor in the level to handle the calls:

This actor would hold the streaming logic instead of the LB handling it. A side benefit is that you can now drop this actor in any level without the need to redo any scripting in the LB. The player (and any other actor) can fetch the reference of that Dummy in more than one way, even without a tag:

Alternatively, if you must have the script in the LB, have the persistent Dummy communicate with the LB:

The player can talk to the Dummy and the dummy can propagate calls via its own dispatcher.

1 Like