How To Get Current Sub Level Name

I try this out and it works very well, so with this function i get my Level name^^

Hello, I’ve been trying to find a way to get the name of the sub level that my character is in currently, using functions like “Get Current Level Name” only return the root level and not the sub level that I’m in.

Is there any way to do this?

Thank you for the help.

Yes the function does work but only for the persistent level for me at least, I’m trying to get the name of the sub level that loaded and am currently in, I’m using level streaming.

Unfortunately, there seems to be no easy way to do this. But by creating a simple actor for this, with a simple collection, you can keep the map name you’re currently in in a variable. Yes, it is a little manual, but I don’t think of any other method.

If you can could you elaborate on how to do that please? the only collection I’m aware of is the one in the content browser.

Sure, for this you need a new actor. You can create like this:

296995-bp-actor.png

After then, you should add a box collision and click On Component Begin Overlap

You need to add one string type variable to your character and the actor you created and keep the level names in this variable.

296997-levelname.png

After everything is ready, you can replace the existing level with the new level name when you hit the collision you created with a blueprint like below.

Finally, you can enter the map name by dragging the actors you created to your scene, adjusting the size from the details tab.

And tadaa, thats it!

Thank you so much!

here CPP code form sublevelName

Try with this in BP

4 Likes

Thankyou! This really helped me

Working! Thanks