This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
在 Windows 和 Linux 上,你可以通过指定其相对或绝对路径在终端中运行 Godot 可执行文件。
On macOS, the process is different due to Godot being contained within a
.app bundle (which is a folder, not a file). To run a Godot binary
from a terminal on macOS, you have to cd to the folder where the Godot
application bundle is located, then run Godot.app/Contents/MacOS/Godot
followed by any command line arguments. If you've renamed the application
bundle from Godot to another name, make sure to edit this command line
accordingly.
"Start the editor in recovery mode, which disables features that can typically cause startup crashes, such as tool scripts, editor plugins,
GDExtension addons, and others.
Override audio output latency in milliseconds (default is 15 ms). Lower values make sound playback more reactive but increase CPU usage, and may
result in audio cracking if the CPU can't keep up
Write output/error log to the specified path instead of the default location defined by the project. <file> path should be absolute or relative to
the project directory.
Generate SPIR-V debug information. This allows source-level shader debugging with RenderDoc.
--extra-gpu-memory-tracking
Enables additional memory tracking (see class reference for
RenderingDevice.get_driver_and_device_memory_report() and linked methods). Currently only implemented for
Vulkan. Enabling this feature may cause crashes on some systems due to buggy drivers or bugs in the Vulkan
Loader. See https://github.com/godotengine/godot/issues/95967
--accurate-breadcrumbs
Force barriers between breadcrumbs. Useful for narrowing down a command causing GPU resets. Currently
only implemented for Vulkan.
Display a rectangle each time a canvas item requests a redraw (useful to troubleshoot low processor
mode).
--max-fps<fps>
Set a maximum number of frames per second rendered (can be used to limit power usage). A value of 0
results in unlimited framerate.
--frame-delay<ms>
Simulate high CPU load (delay each frame by <ms> milliseconds). Do not use as a FPS limiter; use
--max-fps instead.
--time-scale<缩放>
强制时间缩放(值越大速度越快,1.0 是正常速度)。
--disable-vsync
即使在项目设置中启用,也会强制禁用垂直同步。不会覆盖驱动程序级的 V-Sync 执行。
--disable-render-loop
禁用渲染循环,以便仅在从脚本显式调用时才进行渲染。
--disable-crash-handler
当平台代码支持时,禁用崩溃处理程序。
--fixed-fps<帧率>
每秒强制固定数量的帧。此设置禁用实时同步。
--delta-smoothing<启用>
启用或禁用帧间隔平滑(“enable”启用、“disable”禁用)。
--print-fps
将每秒帧数打印到标准输出上。
--editor-pseudolocalization
Enable pseudolocalization for the editor and the project manager.
单独的工具
命令
描述
-s, --script<script>
运行脚本。<script> 必须是相对于项目的资源路径(myscript.gd 会被解释为 res://myscript.gd)或绝对文件系统路径(例如 Windows 上的 C:/tmp/myscript.gd)
--main-loop<main_loop_name>
Run a MainLoop specified by its global class name.
--check-only
仅解析错误并退出(与 --script 一起使用)。
--import
启动编辑器,等待加载一切资源,然后退出。隐含 --editor 及 --quit。
--export-release<preset><path>
Export the project in release mode using the given preset and output path. The preset name should match one defined in 'export_presets.cfg'.
<path> should be absolute or relative to the project directory, and include the filename for the binary (e.g. 'builds/game.exe'). The target
directory must exist.
--export-debug<preset><path>
与 --export-release 类似,但使用调试模板。隐含 --import。
--export-pack<预设><路径>
与 --export-release 类似,但只会以预设参数导出游戏包。<path> 的扩展名决定它是 PCK 还是 ZIP 格式。隐含 --import。
--export-patch<preset><path>
Export pack with changed files only. See --export-pack description for other considerations.
--patches<paths>
List of patches to use with --export-patch. The list is comma-separated.
--install-android-build-template
Install the Android build template. Used in conjunction with --export-release or --export-debug.
--convert-3to4[<最大文件kb值>][<最大行数>]
将项目从 Godot 3.x 转换到 Godot 4.x。
--validate-conversion-3to4[<最大文件kb值>][<最大行数>]
显示把项目从 Godot 3.x 转换到 Godot 4.x 时将重命名哪些元素。
--doctool[<path>]
将引擎 API 参考以 XML 格式转储到给定的 <path> 中,如果路径已有文件则进行合并。
--no-docbase
禁止转储基本类型(与 --doctool 一起使用)。
--gdscript-docs<路径>
不转储引擎 API,而是从 <路径> 找到 GDScript 文件(与 --doctool 一起使用)的内联文档生成 API 引用。
要在 Windows 或 macOS 上轻松实现这一目标,可以使用 Scoop(在 Windows 上)或 Homebrew(在 macOS 上)安装 Godot。这将自动在 PATH 中提供已安装的 Godot 副本:
# Add "Extras" bucket
scoopbucketaddextras
# Standard editor:
scoopinstallgodot
# Editor with C# support (will be available as `godot-mono` in `PATH`):
scoopinstallgodot-mono
# Standard editor:
brewinstallgodot
# Editor with C# support (will be available as `godot-mono` in `PATH`):
brewinstallgodot-mono
# `godot` must be a Godot editor binary, not an export template.# Also, export templates must be installed for the editor# (or a valid custom export template must be defined in the export preset).
godot--headless--export-release"Linux/X11"/var/builds/project
godot--headless--export-releaseAndroid/var/builds/project.apk