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 to run the level blueprint code when opening a new level?

Hi, I'm working on the Main Menu for my project using UMG. I have one empty level that I used for my main menu and another game level that I want to load when I click on the 'New Game' button. When I click on the 'New Game' button, I remove the main menu from viewport and use 'Open Level' to load my new game level. However I noticed that doing so does not load the level blueprint of the new level. When I load the game level directly from editor, this issue does not crop up. So it's definitely a result of the transition from my main menu level to the game level. Also this issue seems to be happening only when I run the game in the editor. The game runs fine when I run it in standalone mode.

So I would like to know if there is some way I could load the level blueprint for a new level, when I'm opening the said new level from another level?

Product Version: Not Selected
Tags:
more ▼

asked Feb 10 '15 at 11:36 AM in Using UE4

avatar image

Stormrage256
967 82 75 117

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

1 answer: sort voted first

We might need more specific info on what you're trying to do. If your new map has a BeginPlay node, it indeed should always run when that level is loaded. You can't access any code from another map than the one you're in as far as I know.

more ▼

answered Feb 10 '15 at 12:45 PM

avatar image

Furroy
691 26 86 61

avatar image Stormrage256 Feb 10 '15 at 12:58 PM

Yes I have a Begin Play node in the game level that I'm trying to load. I have a break point over there to check the code flow. However the level blueprint for this level doesn't run when I open this level from another level. The level itself is running with all the actors around as I had placed them, and the rest of the player input code are running fine. Only those dependent on the level blueprint don't run.

As I had mentioned earlier, this issue is present only when I run the game in the editor window, with the main menu level as the starting level. I'm guessing that only the level that was active in the editor viewport prior to launching the game has it's level blueprint loaded. Any levels that I load subsequently aren't having their level blueprint loaded.

avatar image Stormrage256 Feb 11 '15 at 11:03 AM

It seems everything is working fine now, when running in editor as well. I probably made some errors in my previous code when trying to open the game level.

(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