A tool for converting Godot's GdScript to other languages (currently C# and c++) with features like type inference. Requires Python installed (tested with 3.12.5).
Available from the Asset Lib tab in editor or alternatively download as zip and extract into your project.
Enable in Project Settings->Plugins then you're set.
To use, drag&drop files and folders from the FileSystem dock then click convert.
call the main script using your favorite command line utility (add -t Cpp
for c++) :
python addons/gd2all/converter/main.py <file_or_folder_path> -o <output_file_or_folder_path>
script input :
__test.gd__
C# output :
__test.cs__
c++ output (header) :
__test.hpp__
c++ output (implementation) :
__test.cpp__
- generated code might need corrections !
- pattern matching - a complicated form of the match case statement - is not supported
- when the parser encounters something unexpected it will drop the current line and resume at the next (panic mode). this might result in mangled output.
- read TODO.md for missing features
- C# : godot won't build C# scripts until you have created at least one C# script manually in the editor
- c++ : generated code does a best guess on what whould be pointers/references
- c++ : accessing/modifying parent class properties does not use getters/setters (this is a conscious choice)
- download the offical godot repo
- copy it's
doc/classes
folder and paste it into ourclassData
folder - install untangle (xml parsing library) if you don't have it (
pip install untangle
) - run
py ./addons/gdscript2all/converter/src/godot_types.py
to generate the pickle class db - profit.
If you want to transpile to an unsupported language, rename a copy of the C# transpiler backend,
modify it as needed, then to use it you just have to pass its name with the -t
flag (example below with c++ transpiler):
python ./addons/gdscript2all/converter/main.py -t Cpp <file_or_folder_path>
The code this tool generates from your GDScipt is yours. However, any improvment made to this tool's source has to be contributed back. I think that's fair.