How to reference a BP actor within Level BP

Hi All,

How do I reference a BP actor from the level BP.

Really struggling with this atm, basically its a message that pops up when the player gets to a certain point in my level, for VR it needs to be displayed using an actor bp that in turn references the widget, the standard route of just using a widget which is then added to the display port doesn’t work with VR sadly.

Any ideas?

Get actor of class? Or if there’s many actors spawned of this class you could call get all actors and use a for each look to query display names. Or if it would be viable setup an event dispatcher with an input so you could plug in the exact actor. Can you possibly post screenshots of the BPs running what your trying to do

Hi!
Open your level > select the BP actor you want to reference > Go to Level BP > Right click anywhere in the graph > Create a Reference to Actor.

1 Like

That is biggest problem of level blueprint. :smiley:

Level Blueprint spawns first, then all actors spawn. So you cannot reference actor inside level blueprint. Well technically you can but its a mess.

in level blueprints:

  • on begin play find all actors of class (but it is not really guaranteed they will all spawn, so sometimes you may miss some actors)
  • because of above you need some kind of “real begin play when everything is loaded”, people use delay of 0.2 seconds, but this is also not guaranteed because some actors may be streamed it after 0.2 sec, So hopefully you see problem with level blueprint

Solution to this is using something like game mode, and all spawned actors registering there, so level blueprint knows if something was spawned (by checking array in game mode)

However this whole system gets complicated, so why not move all code from level blueprint to some actor (that is not visible in game), put all code there, and make all spawned ac tors directly register or trigger event in this master actor.

Even better use inheritance for that code, or instead of level blueprint create blueprintable component that has all logic (and stores important stuff in variables in game mode), and you can just drop it on any actor.

TL/DR:
level blueprints are for level specific code that is used only in that level and does not need to interact with actors that may be spawned later. So it is almost useless, i do not know about any case for code that cannot be done better in other ways than level blueprint.

Thanks Nawrot

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.