How do I get a reference to the Level Blueprint?
I have an Actor that has a "time until ready" property. I have a GUI, created by the level blueprint, that has a "time until ready" progress bar. I would prefer for the object to just tell the level how ready it is, and the level to decide how to display that (such as updating the GUI.)
I understand how I can pass a reference to the GUI to the Actor. But that's not what I want to do. How can I get a reference to the Level from the Actor? Or should I use a Custom Event for this?
asked Apr 19 '15 at 02:46 AM in Blueprint Scripting
Cast to the current level is not possible cause each level can be different. Nevertheless if you want to do this, you have to dive deep within C++.
But i would not recommend this.
My advice: Keep all your Level BPs empty and use Custom BPs and spawn them when needed. This way you can develop independent of Levels. You can change GameMode and thus load the components that you currently want to use.
The trick, if want to know what level is currently loaded without writing code, is:
Remember: You can do things for several levels by "if then else", but not select certain parts of the level itself.
Hope that helps :D
If you do not like this solution and do not want to write code then your "Custom Event" solution is probably the the best.
answered Apr 19 '15 at 11:17 AM
Hello! In fact this can be done via the BP-Interface. In Level BP using the message from the input parameter BPI with Object, and through which pass a reference.
answered Sep 01 '16 at 07:54 AM
A fairly easy workaround for this limitation is to create event listeners in your GameMode Blueprint or your Player Blueprint, then bind to / call them from the Level Blueprint.
Since you can get references to these BPs from pretty much any other blueprint (using the "Get GameMode" or "Get Player Pawn/Character" nodes), you can just get a reference to the GameMode or Player (you may have to cast it) in the Level Blueprint, then bind events to the listeners in those blueprints and/or call those listeners.
answered Sep 02 '16 at 10:10 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here