Browse Source

Warn about non-tool plugin scripts in C# (#6138)

* 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
Raul Santos 2 years ago
parent
commit
0cae512d93

+ 2 - 0
tutorials/plugins/editor/inspector_plugins.rst

@@ -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)
@@ -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.

+ 4 - 3
tutorials/plugins/editor/making_plugins.rst

@@ -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