Skip to content

Commit 56d0a58

Browse files
mweibelCalinou
andauthored
Fix headless check in Exporting for dedicated servers (godotengine#8362)
The example didn't work as `--headless` isn't part of `OS.get_cmdline_args()`' return value. This new approach also works if the binary automatically uses headless mode because it's the only display server built in the binary (which can be the case for custom builds). Co-authored-by: Hugo Locurcio <[email protected]>
1 parent 0f46393 commit 56d0a58

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tutorials/export/exporting_for_dedicated_servers.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ main scene (or an autoload)'s ``_ready()`` method:
217217
.. tabs::
218218
.. code-tab:: gdscript
219219

220-
if "--headless" in OS.get_cmdline_args():
220+
if DisplayServer.get_name() == "headless":
221221
# Run your server startup code here...
222222
#
223223
# Using this check, you can start a dedicated server by running
@@ -229,7 +229,7 @@ main scene (or an autoload)'s ``_ready()`` method:
229229

230230
using System.Linq;
231231

232-
if (OS.GetCmdlineArgs().Contains("--headless"))
232+
if (DisplayServer.GetName() == "headless")
233233
{
234234
// Run your server startup code here...
235235
//

0 commit comments

Comments
 (0)