How can you load a map from command line?

Hello,

I would like the player to be able to load a specific map via command line (advanced launch options in steam). I checked Command-Line Arguments | Unreal Engine Documentation and tried the following command:

MyGame.exe /Game/Maps/MyMap
MyGame.exe MyMap

But neither of them seems to work and the game just loads the default map. I also went to the packaging settings and copies across the map directory from the ‘list of maps to include in package build’ but it still didn’t work.

Any idea how I can get this command to work?

Thank you :slight_smile:

Let’s say your project is at:

C:\MyUE4Project

And your map you want to load is at (your map must be inside Content folder or its subfolders):

C:\MyUE4Project\Content\MyMaps\TestMap01

Then you would pass your map as (notice the suffix “/Game/”):

/Game/MyMaps/TestMap01

So you can load your game using any of the ff. command:

MyGame.exe /Game/MyMaps/TestMap01

OR

C:\UE4\Engine\Binaries\Win64\UE4Editor.exe C:\MyUE4Project\MyUE4Project.uproject /Game/MyMaps/TestMap01
1 Like

will this work for dedicated servers?