I am implementing a level selecting menu. I want to dynamically load all levels and add them into the GUI so players can select which level they want to play.
Is there a function to get the information I want?
I am implementing a level selecting menu. I want to dynamically load all levels and add them into the GUI so players can select which level they want to play.
Is there a function to get the information I want?
I would like to know this a well. I need a way of getting all the names of all existing levels in the content folder so I can automatically update a level selecting widget.
You should be able to save the name of all existing levels into strings and load them in the manner that you want.
For example, having two levels named ‘One’ and ‘Two’. You’d make two string variables with those names. On ‘E’ button input, load [string1] or load[string2].
Not quite what I’m looking for. I will be creating many levels and rather than having to duplicate lots of programming for each levels corresponding button I’d like to populate a list based on all the existing levels without having to go and add each one into a string variable. I’d just like a function that gets all the level names as a string array. Is that possible?
I did a little looking around for you and i think this is what you’re looking for. Its in code but also blueprint accessible.
https://answers.unrealengine.com/questions/134539/list-all-maps-in-project-or-directory.html
Yes, this is exactly what I’m looking for only I have no idea how to incorporate C++ into my game. Is it a lot of effort to start learning C++ or should I just manually code my levels. Thank you for your help.
You can create a large portion of your game simply through blueprints, but it doesn’t hurt to know C++ as well, as sometimes its the better choice.
As for the effort to start learning, if you have no prior experience with coding it could be overwhelming to start. However, there is a plethora of documentations/tutorials around to help you along the way if you feel up to the challenge.
My recommendation is that you get comfortable with blueprints and then ease your way into using C++ code in your project. You’ll see the similarities in logic between the two.
Hello,
Sorry for resurrecting an old thread, but a lot of people may be interested in the fact, that since 4.17 it’s possible to get names of all levels in BP, without using C++. Asset Registry can be used to gather info about all assets in our project as far as I know. It’s just a matter of learning the name of the class of what we are interested in. In case of levels it’s “World” class. In the example below I then look at each element of an array of World assets and then do something more only with those located in “/Game/Levels”. The “/Game/” part is important, it’s your “Content” folder.
There are more nodes to get data from Asset Registry, so you probably can do the same in a different manner. That’s just the way I used to create my debug menu. I use “Asset Name” later to attach to a button.
thanks for resurrecting, it’s very help!)
and for knowing the names of class - just right click on the asset, the name after word “open” and before “.h” - it’s class name (Texture2D in this case)
Thank you , you save me!!