x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Product Version: Not Selected
Tags:
more ▼

asked Apr 19 '15 at 02:46 AM in Blueprint Scripting

avatar image

jwatte
1.2k 48 38 87

(comments are locked)
10|2000 characters needed characters left

5 answers: sort voted first

If you want to communicate with the level blueprint from a class blueprint youll need to use an event dispatcher. Its the same principle as "cast to level blueprint"

link

more ▼

answered Aug 27 '15 at 08:48 AM

avatar image

Skos
86 7 14

avatar image MetricZero Feb 13 '17 at 02:30 AM

Thanks for that link man. Solved my issue.

avatar image ilias48rus Mar 22 '18 at 02:05 PM

wish everyone would stop proposing eventDispatchers like they have anything to do with blueprints communication, they just letting to execute different events in same time, basicaly helpfull in terms of parenting (eventHit and similar things which should execute something for all clild classes and can be used to execute additional scripts in theses classes is actualy eventDispatchers)

(comments are locked)
10|2000 characters needed characters left

Hi,

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++.

https://answers.unrealengine.com/questions/122415/how-to-get-map-name-in-bp.html#answer-148974

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:

  1. Create a custom BP (I recommend an Actor BP) and call it for example "LevelMarker"

  2. Put this BP into your Level and give it the name of the level where the BP was placed in

  3. This BP should exist only one time per level

  4. You can now access the current level by "Get all Actors from Class", the Class is "LevelMarker"

  5. Just watch the picture: This tells you how to test or use it

alt text

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.

Cheers :D

more ▼

answered Apr 19 '15 at 11:17 AM

avatar image

Raidfire.Net
575 58 53 113

avatar image eXi Apr 19 '15 at 01:52 PM

He should just use the GameState class for this. This class is designed to contain information about the state of the Game and it is reseted for each level.

If he wants to provide level specific information, then he can get the GameState in the LevelBlueprint and set different values.

The GameState can be accessed easily by just searching for "GameState" in a graph. You can create our own GameState Blueprint and set it in the Maps and Nodes or in the Default Settings of you GameMode Blueprint.

You can also have a look at the PlayerState class. You can create your own and set it inside the GameMode Blueprint Default settings (only there. not in the maps and nodes). The GameState contains an array of all PlayerStates if you are running a MultiplayerGame.

avatar image jwatte Apr 19 '15 at 11:12 PM

OK, seems like using the level blueprint isn't that useful, then. By the way, what is the single page that tells me the lifetime / reset-times / intended state of each of the GameState, PlayerController, GameMode, and Level classes? (This information may be possible to gather by reading all of the documentation end-to-end... but if someone already did that, everyone would save time, including me :-)

(comments are locked)
10|2000 characters needed characters left

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.

more ▼

answered Sep 01 '16 at 07:54 AM

avatar image

shiwron
1 1 1 2

(comments are locked)
10|2000 characters needed characters left

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.

more ▼

answered Sep 02 '16 at 10:10 PM

avatar image

monotoan
96 2 5 7

(comments are locked)
10|2000 characters needed characters left

I made a quick tutorial for this (event dispatcher can help) https://www.youtube.com/watch?v=IbiocEDwosw&t=84s

more ▼

answered Dec 13 '18 at 02:12 PM

avatar image

Shauntezuma
1 1 2

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question