From 0dd65378e7594e8916474613116d8df485870710 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 29 Jul 2022 15:30:52 +0200 Subject: Add support for command-line user arguments. Implements the standard Unix double dash (--) commandline argument: * Arguments after a double dash (--) are ignored by Godot and stored for the user. * User can access them via `OS.get_cmdline_user_args()` Example: `godot.exe scene_to_run.tscn --fullscreen -- --start-level 2` --- doc/classes/OS.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'doc/classes') diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 5473347cb1..49c666ec51 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -198,6 +198,17 @@ } [/csharp] [/codeblocks] + [b]Note:[/b] Passing custom user arguments directly is not recommended, as the engine may discard or modify them. Instead, the best way is to use the standard UNIX double dash ([code]--[/code]) and then pass custom arguments, which the engine itself will ignore. These can be read via [method get_cmdline_user_args]. + + + + + + Similar to [method get_cmdline_args], but this returns the user arguments (any argument passed after the double dash [code]--[/code] argument). These are left untouched by Godot for the user. + For example, in the command line below, [code]--fullscreen[/code] will not be returned in [method get_cmdline_user_args] and [code]--level 1[/code] will only be returned in [method get_cmdline_user_args]: + [codeblock] + godot --fullscreen -- --level 1 + [/codeblock] -- cgit v1.2.3