GDExtension template that automatically builds into a self-contained addon for the Godot Asset Library.
This template is only intended to work with the latest master
on GitHub, not the latest point release, such as beta1
. Before reporting an issue, make sure you are on the latest master
and the submodule godot-cpp
is up-to-date by running the command git submodule update --remote
.
- Clone this repository (or a new repository with this template) with submodules.
git clone --recurse-submodules https://github.com/nathanfranke/gdextension.git
\cd gdextension
- Build a debug binary for the current platform.
scons
- Import, edit, and play
project/
using Godot Engine 4+.- Alternatively, run the project using the terminal.
- Either alias an existing executable to godot4:
alias godot4="~/workspace/godot/bin/godot.linuxbsd.tools.x86_64"
- Or, on Arch Linux, install
godot4-bin
from the AUR (yay -S aur/godot4-bin
).
- Either alias an existing executable to godot4:
- Finally,
godot4 --path project/
- Alternatively, run the project using the terminal.
- Check the output:
Hello GDScript! Hello GDExtension Node! Hello GDExtension Singleton!
project/
- Godot project boilerplate.addons/example/
- Files to be distributed to other projects.¹demo/
- Scenes and scripts for internal testing. Not strictly necessary.
src/
- Source code of this extension.godot-cpp/
- Submodule needed for GDExtension compilation.
¹ Before distributing as an addon, all binaries for all platforms must be built and copied to the bin/
directory. This is done automatically by GitHub Actions.
- Rename
project/addons/example/
andproject/addons/example/example.gdextension
. The library name is automatically changed to the gdextension file name. - Replace
LICENSE
,README.md
, and your code insrc/
. - Not required, but consider leaving a note about this template if you found it helpful!
- Go to Repository→Actions and download the latest artifact.
- Test the artifact by extracting the addon into a project.
- Create a new release on GitHub, uploading the artifact as an asset.
- On the asset, Right Click→Copy Link to get a direct file URL. Don't use the artifacts directly from GitHub Actions, as they expire.
- When submitting/updating on the Godot Asset Library, Change "Repository host" to
Custom
and "Download URL" to the one you copied.