From 0cae512d93b1d50132f8b6036d6bca337a4c771f Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Sat, 15 Oct 2022 18:21:14 +0200 Subject: [PATCH] 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 --- tutorials/plugins/editor/inspector_plugins.rst | 2 ++ tutorials/plugins/editor/making_plugins.rst | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tutorials/plugins/editor/inspector_plugins.rst b/tutorials/plugins/editor/inspector_plugins.rst index eaf4f3e4646..79394636f8d 100644 --- a/tutorials/plugins/editor/inspector_plugins.rst +++ b/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. diff --git a/tutorials/plugins/editor/making_plugins.rst b/tutorials/plugins/editor/making_plugins.rst index d7a0caac370..acad761a1e6 100644 --- a/tutorials/plugins/editor/making_plugins.rst +++ b/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