Index of every page on this site: llms.txt
All skills
jame581 avatar

/addon-development

@426e8ab
by Jan Mesarčjame581/godotprompter979 stars
63
Run it yourself

Use when creating Godot editor plugins — EditorPlugin, @tool scripts, custom inspectors, and dock panels

Use this Skill: https://skilld.dev/gh/jame581/godotprompter/addon-development

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencestesting-plugins.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

← Back to SKILL.md

Testing and Debugging Plugins

Reloading a plugin in the editor

The fastest way to reload plugin code without restarting Godot:

  1. Project → Project Settings → Plugins (Project Settings → Addons → Plugins on 4.8) → untick the plugin → tick it again.
  2. Alternatively, run this EditorScript from the script editor (File → Run, Ctrl+Shift+X; the script must be a @tool script that extends EditorScript):
# EditorScript — run with File → Run in the script editor.
@tool
extends EditorScript

func _run() -> void:
    var plugin_name := "my_plugin"
    # Disable then re-enable to force a clean reload cycle.
    EditorInterface.set_plugin_enabled(plugin_name, false)
    EditorInterface.set_plugin_enabled(plugin_name, true)
    print("Plugin %s reloaded." % plugin_name)

Do not reload by writing editor_plugins/enabled through ProjectSettings — that key holds every enabled plugin, so overwriting it disables all of them and re-enables none.

For quicker iteration, save the plugin script — Godot hot-reloads @tool scripts automatically. Complex changes (new class registrations, dock changes) require a full disable/enable cycle.

C# has a dedicated editor API for the same disable/enable cycle, so you do not have to go through ProjectSettings:

#if TOOLS
[Tool]
public partial class PluginReloader : EditorScript
{
    public override void _Run()
    {
        var pluginName = "my_plugin";
        // Disable then re-enable to force a clean reload cycle.
        EditorInterface.Singleton.SetPluginEnabled(pluginName, false);
        EditorInterface.Singleton.SetPluginEnabled(pluginName, true);
        GD.Print($"Plugin {pluginName} reloaded.");
    }
}
#endif

C# plugin reload caveat: unlike GDScript, C# plugins require recompilation. After editing C# plugin source the editor must rebuild the assembly before re-enabling. If the plugin fails to load with "Unable to load addon script from path … This might be due to a code error in that script", the C# project most likely failed to compile — check the MSBuild Panel at the bottom of the editor for compilation errors.

Debugging with print

print() and push_error() / push_warning() output to the Godot Output panel and the OS console when Godot is launched from a terminal.

func _enter_tree() -> void:
    print("[my_plugin] _enter_tree called")   # Output panel
    push_warning("[my_plugin] something unexpected")
    push_error("[my_plugin] something failed")  # also shown as red in Output
// C# equivalent — same Output panel, same OS console.
#if TOOLS
public override void _EnterTree()
{
    GD.Print("[my_plugin] _EnterTree called");      // Output panel
    GD.PushWarning("[my_plugin] something unexpected");
    GD.PushError("[my_plugin] something failed");   // also shown as red in Output
}
#endif

To see that output in a console on Windows, launch the console wrapper that ships next to the editor (…_console.exe); the main .exe is a GUI-subsystem program and does not attach to a terminal:

Godot_v4.3-stable_win64_console.exe --editor --path /path/to/project

Plugin lifecycle gotchas

Situation What happens Fix
Plugin enabled but _enter_tree crashes Plugin remains enabled but broken; editor may be unstable Disable, fix, re-enable
Forgot to remove a dock in _exit_tree Dock orphan survives disable; duplicate docks appear on next enable Always null-check and queue_free() in _exit_tree
Custom type still listed after removal Usually a missing remove_custom_type() in _exit_tree() Add the call; restart the editor if the entry persists
@tool script crashes on property set Editor shows the error but the script stops updating Guard with if Engine.is_editor_hint() and validate inputs
C# plugin not compiling Plugin fails to load with "Unable to load addon script from path …" Click the icon-only Build Project button in the top-right run bar, left of the Play button (Alt+B; .NET editor only), then read the MSBuild panel and fix C# errors first
add_inspector_plugin called twice Inspector plugin fires twice per property Track and guard with a null-check before add_inspector_plugin

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 alert7d3 checks · Risk SAFE
  • Gen Agent Trust Hub7d

    This skill provides documentation and code templates for developing Godot editor plugins in GDScript and C#. The analysis found no evidence of malicious patterns, obfuscation, or unauthorized data access.

  • Socket7d

    No alerts

  • Snyk7d

    Risk: CRITICAL · 1 issue

Signed by skilld at 426e8ab. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 6 days ago.

Activeupdated last week

README badge

README badge for jame581/godotprompter/addon-development