Skip to content

Commit af79075

Browse files
committed
Emphasize script classes over custom types in Making plugins
Custom types were more relevant in the early Godot 3.x days, but nowadays, script classes should be preferred whenever possible (i.e. in any non-C# language).
1 parent 0fce3e7 commit af79075

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tutorials/plugins/editor/making_plugins.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,14 @@ custom behavior.
153153

154154
.. warning::
155155

156-
Nodes added via an EditorPlugin are "CustomType" nodes. While they work
156+
Nodes added via an EditorPlugin's :ref:`add_custom_type() <class_EditorPlugin_method_add_custom_type>`
157+
function are "custom type" nodes. While they work
157158
with any scripting language, they have fewer features than
158159
:ref:`the Script Class system <doc_gdscript_basics_class_name>`. If you
159-
are writing GDScript or NativeScript, we recommend using Script Classes instead.
160+
are using GDScript or GDExtension, we recommend using Script Classes instead.
161+
162+
Custom types are still the recommended approach for C#, as it does not support
163+
Script Classes.
160164

161165
To create a new node type, you can use the function
162166
:ref:`add_custom_type() <class_EditorPlugin_method_add_custom_type>` from the
@@ -231,12 +235,19 @@ dialog. For that, change the ``custom_node.gd`` script to the following:
231235
func _enter_tree():
232236
# Initialization of the plugin goes here.
233237
# Add the new type with a name, a parent type, a script and an icon.
238+
#
239+
# NOTE: If `my_button.gd` uses `class_name MyButton`, do not call `add_custom_type()`
240+
# and leave this function empty instead.
241+
# Script Classes and custom types will conflict if the same name is used for both.
234242
add_custom_type("MyButton", "Button", preload("my_button.gd"), preload("icon.png"))
235243

236244

237245
func _exit_tree():
238246
# Clean-up of the plugin goes here.
239247
# Always remember to remove it from the engine when deactivated.
248+
#
249+
# NOTE: This should not be called if Script Classes are used instead.
250+
# In this case, leave this function empty.
240251
remove_custom_type("MyButton")
241252

242253
.. code-tab:: csharp

0 commit comments

Comments
 (0)