Download

Get current level name

How can I find what level is currently being played in Blueprint?

I’m not using streaming levels and can’t find any other mention of getting level names.

Hi Epok,

I was trying to figure that out as well. Unfortunately I haven’t figured it out yet so I came up with another solution for my project which works for me for now. Create an Enum and add the names of all your saved levels. Now in level blueprint you can create a variable and choose enum as type. Under that list you should be able to find the title of the enum file in your content browser show up. Now you should be able to choose any level you want to go to next.

a926b1bb9ad013203b9b477c23d1e8f2cdcaa036.jpeg
Nodes used.
Enum -> to string -> to name -> open level

Thanks for the tip!

Unfortunately this isn’t suitable for what I’m trying to do as I need my game to know what level it is on when it has been booted from a random level in the editor.

Whenever it chooses the Random Level you should be able to save the name of that level in a variable.

The random level isn’t chosen by any code/blueprint though, it’s just whatever level is loaded in the editor when you hit play. I need a way to find out what that level is, so it can be stored as the current level.

For now I’ve ‘hard coded’ it into each level’s Level Blueprint, but doing that on every new level would suck! There must be a way to automatically detect it.

Is a bit of a hack but this works, just be careful to avoid underscores (_) in your level name.

To clarify some confusion - it works in Level Blueprint, although “Get Display Name” doesn’t appear in context menu or even out of context menu in Level Blueprint.
I’ve just recreated the nodes in other blueprint and pasted to level Blueprint.

I don’t know if this will help, or even if it is what you are looking for, but what we do is:

>Create an actor called LEVEL_SETTINGS.
>Create a public variable string called MapName.
>Create whatever other variables we need.
>Drop an instance of it into the level.
>Set the map name.
>Then from whatever blueprint/code you want to check the level name from, just ForEach->GetActorsofClass(LEVEL_SETTINGS)->Cast to LEVEL_SETTINGS->Get MapName.

This works for us, since we need that map name.

Man this is so janky lol but i like it