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`
This commit is contained in:
parent
6d599ed90b
commit
0dd65378e7
7 changed files with 41 additions and 6 deletions
|
|
@ -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].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_cmdline_user_args">
|
||||
<return type="PackedStringArray" />
|
||||
<description>
|
||||
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]
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_config_dir" qualifiers="const">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue