Skip to content

Commit

Permalink
Warn about non-tool plugin scripts in C# (#6138)
Browse files Browse the repository at this point in the history
* Warn about non-tool plugin scripts in C#

- Add warning about C# plugins not reloaded when they are not tools
- Add `[Tool]` attribute to plugin scripts in examples so they are not lost on reload
  • Loading branch information
raulsntos authored and mhilbrunner committed Sep 10, 2024
1 parent 000cccf commit 0cae512
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tutorials/plugins/editor/inspector_plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ specifically add :ref:`class_EditorProperty`-based controls.
#if TOOLS
using Godot;

[Tool]
public class MyInspectorPlugin : EditorInspectorPlugin
{
public override bool CanHandle(Object @object)
Expand Down Expand Up @@ -247,6 +248,7 @@ followed by ``set_bottom_editor()`` to position it below the name.
#if TOOLS
using Godot;

[Tool]
public class RandomIntEditor : EditorProperty
{
// The main control for editing the property.
Expand Down
7 changes: 4 additions & 3 deletions tutorials/plugins/editor/making_plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ editor, and it must inherit from :ref:`class_EditorPlugin`.

.. warning::

In addition to the EditorPlugin script, any other GDScript that your plugin uses
must *also* be a tool. Any GDScript without ``tool`` imported into the editor
will act like an empty file!
In addition to the EditorPlugin script, any other script that your plugin uses
must *also* be a tool.
* Any GDScript without ``tool`` imported into the editor will act like an empty file!
* Any C# class without ``[Tool]`` won't be reloaded when the project is built forcing you to re-enable the plugin!

It's important to deal with initialization and clean-up of resources.
A good practice is to use the virtual function
Expand Down

0 comments on commit 0cae512

Please sign in to comment.