From 56d0a58cdf58ad3ef04a7e29b15861bfb17e4bec Mon Sep 17 00:00:00 2001 From: Michael Weibel <307427+mweibel@users.noreply.github.com> Date: Wed, 1 Nov 2023 19:29:22 +0100 Subject: [PATCH] Fix headless check in Exporting for dedicated servers (#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 --- tutorials/export/exporting_for_dedicated_servers.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/export/exporting_for_dedicated_servers.rst b/tutorials/export/exporting_for_dedicated_servers.rst index 161199e73ef..5c84fcf96ef 100644 --- a/tutorials/export/exporting_for_dedicated_servers.rst +++ b/tutorials/export/exporting_for_dedicated_servers.rst @@ -217,7 +217,7 @@ main scene (or an autoload)'s ``_ready()`` method: .. tabs:: .. code-tab:: gdscript - if "--headless" in OS.get_cmdline_args(): + if DisplayServer.get_name() == "headless": # Run your server startup code here... # # Using this check, you can start a dedicated server by running @@ -229,7 +229,7 @@ main scene (or an autoload)'s ``_ready()`` method: using System.Linq; - if (OS.GetCmdlineArgs().Contains("--headless")) + if (DisplayServer.GetName() == "headless") { // Run your server startup code here... //