How to get level name in BP?
I know that you can do it using C++, but how to do it with blueprints?
I'm setting up a save game blueprint and need this to make it work. The idea is to save the level name as a variable, and then load the saved level name when the game is loaded.
I know this is an old thread, but they recently added a 'Get Current Level Name' function to BP. I thought I'd leave this answer here for you and anyone stumbling upon this thread.
answered Oct 19 '15 at 12:07 PM
You will have to do this with C++ and create a custom node for now (as of UE4.6.1 there's still no node).
To get the current level name:
But the level name is prefixed, depending where it runs (PIE, Window), so, in order to get the prefix:
Then you can perform a string replace removing the prefix and get the level name :)
answered Dec 17 '14 at 10:55 PM
Afaik there is no variable for that.
It could be complicated, especially for level streaming. Since one host level can load several others.
Haven't tried, but each lvl can execute on load event and append name in array of loaded levels.
Since the only way to load level is provide it's name - I don't see any reason to make that variable hardcoded. Level - top element of hierarchy. It's level who loads everything else. (I guess the chance of being inside of level that was mystically loaded is fairly low).
answered Oct 24 '14 at 05:59 AM
The .h file has...
And the .cpp is...
answered Feb 21 '15 at 06:35 PM
SND R Keene
One simple way to do this in BP without using C++ is make your own variable in GameMode and feed ;
Create your own GameMode; Create a variable MapName into GameMode;
In your level blueprint / BeginEvent set MapName (make this all maps want to control)
Now to get map name only to do is call function:
get game mode -> cast to your game mode->get MapName
answered Apr 15 '15 at 01:41 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here