Skip to content

Instantly share code, notes, and snippets.

@Qubus0
Last active January 14, 2024 20:55
Show Gist options
  • Save Qubus0/ae9c138a19d98075ff5d0a06db869f53 to your computer and use it in GitHub Desktop.
Save Qubus0/ae9c138a19d98075ff5d0a06db869f53 to your computer and use it in GitHub Desktop.
How to make plugin development in Godot easier

Plugin Development

Basics

Creating a new plugin is best done through the ProjectSettings under Plugins > Create (top right)

Messing up the editor nodes happens quite a lot. When it does, you can use the Reload Current Project button from the top menu > Project. If it happens often, you can also set a shortcut for it. Useful in combination with that is the EditorSetting (not project) to re-open all scenes which were previously open. You can find it under this path interface/scene_tabs/restore_scenes_on_load

Helpful plugins to develop other plugins

Restarting a plugin again and again after an edit can get quite cumbersome if it requires 3 clicks and a bit of searching every time... If you want to avoid that, this plugin makes it a single click

Plugin Refresher (3.x) by willnationsdev (4.x) by mrpedrobraga


If you are working with editor nodes, this one is almost unavoidable. You can view the whole editor node scene tree with it and even save branches of it as your own scenes. Perfect for recreating editor nodes. The most useful feature here is F12, which takes you directly to the node under your cursor.

Editor debugger (3.x) (4.x) by Zylann


If you want to use have a look at all the theme properties from the editor, this plugin comes in very handy. You can also copy the code to get them from the theme or save the resources to your drive without scouring the source code. Hint: the panel for it is hidden in the top menu bar under Project > Tools > Editor Theme Explorer

Editor Theme Explorer (3.x) by YuriSizov

This one is a lot more convenient than the built-in explorer, which you can find like this: Create a new control > Property: Theme > New Theme > Top right: Manage Items > Tab: Import Items > Tab: Editor Theme

Working with version control

The best way to work on a plugin is inside of another project. This can actually be done with a very simple shell/terminal command on Unix-like systems and (slightly less reliably) also on Windows. This command creates a so-called symbolic link (Wikipedia) to project one directory into another place in the file system. The neat thing about this type of link is, that there is only one true source of a file, but it can still be edited in both places. You can create a symlink with this command:

Windows

mklink /D <path to source directory> <path to target location>

Mac/linux

ln -s [path to source directory> <path to target location>

My personal setup with symlinks is to have one project folder for all the addon stuff with git files, license, readme and everything else in there.

PluginProject/
├─ addons/
│  ├─ amazing_plugin/
│  │  ├─ plugin.cfg
│  │  ├─ plugin.gd
├─ .gitignore
├─ LICENSE
├─ README.md

Then I have a separate project with an /addons directory. Into which I symlink the addon. All of the files will be editable, but are still only modified in the source location. They also won't interfere with any git history on the main project.

Game/
├─ addons/
│  ├─ 🔗 amazing_plugin/
│  │  ├─ plugin.cfg
│  │  ├─ plugin.gd
├─ main.gd
├─ main.tscn
├─ project.godot

My personal setup with symlinks is the following:

Limiting what is being downloaded

If you don't want to flood the user of your plugin with files when they download your plugin, you can use a .gitattributes file to selectively enable and disable file paths. export-ignore will disable files and !export-ignore will enable them again. I like this way of disabling everything and then re-enabling the addons directory and a few demo files. If you want to test your paths use something like this Glob Tool.

** export-ignore

/addons !export-ignore
/addons/** !export-ignore
colors_demo.gd !export-ignore
colors_demo.gdshader !export-ignore

Inspiration?

Well, the Asset Library of course

But also the first (and only, sadly) Godot Add-on Jam, hosted by MrEliptik. Take special note of the Resources section, since it has some nice tutorials for beginners and also a few for advanced users.

For your convenience: All tutorials listed there

Advanced

You can also just search itch.io for addons, or for plugins, or even for Godot tools


If you want to support me, you can

Buy Me A Coffee
@AnidemDex
Copy link

The theme explorer is not necessary since they added a theme explorer in editor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment