Up to date
This page is up to date for Godot
If you still find outdated information, please open an issue.
使用 .NET 编译¶
You can use
dotnet --infoto check which .NET SDK versions are installed.
启用 .NET 模块¶
By default, the .NET module is disabled when building. To enable it, add the
module_mono_enabled=yes to the SCons command line, while otherwise
following the instructions for building the desired Godot binaries.
Parts of the sources of the managed libraries are generated from the ClassDB.
These source files must be generated before building the managed libraries.
They can be generated by any .NET-enabled Godot editor binary by running it with
--headless --generate-mono-glue followed by the path to an
This path must be
modules/mono/glue in the Godot directory:
<godot_binary> --headless --generate-mono-glue modules/mono/glue
This command will tell Godot to generate the C# bindings for the Godot API at
modules/mono/glue/GodotSharp/GodotSharp/Generated, and the C# bindings for
the editor tools at
Once these files are generated, you can build Godot's managed libraries for all
the desired targets without having to repeat this process.
<godot_binary> refers to the editor binary you compiled with the .NET module
enabled. Its exact name will differ based on your system and configuration, but
should be of the form
bin/godot.windows.editor.x86_32.mono.exe. Be especially aware of the
.mono suffix! If you've previously compiled Godot without .NET support, you
might have similarly named binaries without this suffix. These binaries can't be
used to generate the .NET glue.
每次ClassDB注册的API更改时, 都必须重新生成胶水源码. 即, 例如, 当将新方法注册到脚本API时, 或该方法的参数之一发生更改时. 如果ClassDB和胶水源码之间的API不匹配,Godot将在启动时打印一条错误.
Once you have generated the .NET glue, you can build the managed libraries with
By default, all development builds share