Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Visual Studio

Visual Studio Community微软的一个只面向 Windows 的 IDE,个人或者组织内的非商业使用是免费的。它有很多有用的功能,如内存视图、性能视图、源码控制等。


Visual Studio需要一个解决方案文件来处理一个项目. 虽然Godot没有附带解决方案文件, 但可以使用SCons生成.

  • 导航到Godot根文件夹, 打开命令提示符或PowerShell窗口.

  • Run scons platform=windows vsproj=yes dev_build=yes to generate the solution with debug symbols.
    The vsproj parameter signals that you want Visual Studio solution generated.
    The dev_build parameter makes sure the debug symbols are included, allowing to e.g. step through code using breakpoints.
  • 现在您可以通过双击项目根目录下的 godot.sln 或使用Visual Studio中的 打开项目或解决方案 选项来打开项目.

  • 从顶部菜单 Build [编译]来编译构建这个项目.


Visual Studio must be configured with the C++ package. It can be selected in the installer:



Visual Studio具有强大的调试器, 允许用户检查Godot的源代码, 在代码中的特定点中断, 检查当前的执行上下文, 并对代码库进行实时修改.

You can launch the project with the debugger attached using the Debug > Start Debugging option from the top menu. However, unless you want to debug the Project Manager specifically, you'd need to configure debugging options first. This is due to the fact that when the Godot Project Manager opens a project, the initial process is terminated and the debugger gets detached.

  • 要配置与调试器一起使用的启动选项, 请使用顶部菜单中的 Project > Properties [项目 > 属性]:

  • Open the Debugging section and under Command Arguments add two new arguments: the -e flag opens the editor instead of the Project Manager, and the --path argument tells the executable to open the specified project (must be provided as an absolute path to the project root, not the project.godot file; if the path contains spaces be sure to pass it inside double quotation marks).


要了解更多的命令行参数, 请参考 命令行教程 .

即使你在没有连接调试器的情况下启动项目, 也可以使用 Debug > Attach to Process... [调试 >附加到进程]菜单连接到正在运行的进程.

要检查一切是否正常,请将断点放在 main.cpp 中,然后按 F5 开始调试。