Play level from command line on linux

I need to run UE4 (4.26) Editor on a linux (Debian 10) server with no display and play the default level.

I have followed this post to setup UE4 and build the project on linux.

As per this post’s suggestion, I run the following to start the project from terminal

/path/to/UE_4.26/Engine/Binaries/Linux/UE4Editor /project/path/somename.uproject -windowed -RenderOffscreen -game

However, this doesn’t seem to play the default level. I also tried to run the following

/path/to/UE_4.26/Engine/Binaries/Linux/UE4Editor /project/path/somename.uproject -windowed -RenderOffscreen -ExecutePythonScript="/path/to/python/script/play_level.py"

where play_level.py is

import unreal
obj = unreal.EditorLevelLibrary()
obj.editor_play_simulate()

But this doesn’t work either.

To clarify, I would like to play the level (using the play option in GUI image shown below) and not launch the game.

Thanks

Actually, it takes a long time to start the first time hence couldn’t see it. The following command works without any issues

/path/to/UE_4.26/Engine/Binaries/Linux/UE4Editor /project/path/somename.uproject -windowed -RenderOffscreen -game
1 Like