Load map from file in-game

Greetings,

How can I load a map from a simple .umap file while in-game? I would like to do this as I plan to have the game load custom player-made levels later on (Perhaps through steam Workshop too)

Thanks in advance!

Edit: Sorry for the misunderstanding, what I mean by loading the map while in-game, is loading a map that has been placed in a folder AFTER the game has already been packaged, so that users can place their custom-built maps there to use in-game!

You can use Console Command blueprint and run the following command: open “YourMapName” (with out the .umap_
However, I don’t think it’s possible to do this as the maps will need to be cooked and indexed in your game. However you should try it anyways.

Good Luck!

You need to make sure that all your maps are placed inside of your Content folder, by default they should go into a Maps subfolder in your Content folder.

Here’s a quick tutorial that shows loading levels from blueprints.

Yes, but I meant from the packaged build. How can I load a map from a file that has been manually placed after the game has been packaged?

Packaged or not, the functionality will never change. If you have a node in your game that says “Open Level MyLevel” and it works fine in editor, it will work the same way in a packaged game.

The problem will be with the need to cook the map content and prepare it for deployment.

You can’t cook on the fly, so, whoever created the map that will be added to the game needs to cook the content for distribution, you can’t just copy the .umap over

Ah! That makes life easier! So I must have all maps stored in a Content folder within the root directory, then everything else is managed? What about two levels of different filenames having the same name? Is there a way I can manage that?

The engine will get confused when ANY asset has the same name as a map. Make sure you provide an appropriate naming convention for your assets that way it won’t attempt to load a widget called “MyLevel” instead of your map called “MyLevel”.

Never have two assets with the same name, regardless what those types are. Widgets, actors, levels, sounds, etc.

Ah alright. I’ll depend on having users not name their map the same as another one, which will probably work as they won’t want to have their map the same name as another anyway. Thanks for the help! I shall mark this answer as the accepted one. Appreciate it!

Hello! I just realized through the other guys answer where you were trying to get at. Your answer was actually correct, but I never knew maps must be in the content folder of the cooked game. Thanks for the help though! :smiley:

You can’t cook on the fly, so, whoever
created the map that will be added to
the game needs to cook the content for
distribution, you can’t just copy the
.umap over
So how does this work then? How do you call cooked map? With name?

I was thinking perhaps that is related to the toolkits some UE4 games use to make maps, such as SQUAD and ARK. Since they have their own dedicated map making software, perhaps that’s the only way? I would wish there could be some sort of in-game level editing or something

Did you get any luck to call map/level from cooked game? I have same issue here, we need to make levels and call by command-line at run time. Not sure how to deal with it…

I managed to use the ‘Open Level’ node with a file path to the .umap :slight_smile: