Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

获取源代码

下载 Godot 源代码

进入 SCons 构建系统并编译 Godot 之前,你需要将 Godot 的源代码下载到本地。

源代码位于 GitHub 上, 虽然你可以通过网站手动下载它, 但是通常你希望通过 git 版本控制系统来下载.

如果你是为了做贡献或拉动请求而进行编译,你应该遵循拉取请求工作流中的说明。

如果你还不太了解 git,在各种网站上都有大量的 Git 教程

通常,你需要安装 git 和/或其他带有 git 的 GUI 客户端。

之后,要获得最新版本的 Godot 源代码(不稳定的 master 分支),可以使用 git clone

如果你使用 git 命令行,可以通过在终端输入下列命令来完成:

git clone https://github.com/godotengine/godot.git
# You can add the --depth 1 argument to omit the commit history.
# Faster, but not all Git operations (like blame) will work.

要获取稳定版本的源代码,请访问源代码发布页面然后单击所需发行版的链接。然后,你可以从页面上的下载链接下载并解压源代码。

使用 git 时你还可以通过在 --branch (或者 -b )参数后指定分支或者标签,来克隆稳定版本:

# Clone the continuously maintained stable branch (`3.x` as of writing).
git clone https://github.com/godotengine/godot.git -b 3.x

# Clone the `3.2.3-stable` tag. This is a fixed revision that will never change.
git clone https://github.com/godotengine/godot.git -b 3.2.3-stable

此外,你可以通过 git 在各个主要版本的分支间进行切换。

获取到 Godot 的源代码之后,你就可以继续编译 Godot 了。