diff --git a/tutorials/scripting/c_sharp/c_sharp_global_classes.rst b/tutorials/scripting/c_sharp/c_sharp_global_classes.rst index 8bf12527e..7a13a5511 100644 --- a/tutorials/scripting/c_sharp/c_sharp_global_classes.rst +++ b/tutorials/scripting/c_sharp/c_sharp_global_classes.rst @@ -3,8 +3,11 @@ C# global classes ================= -Global classes (also known as named scripts) are types registered in Godot's editor so they can be used -more conveniently. +Global classes (also known as named scripts) are types registered in Godot's +editor so they can be used more conveniently. +:ref:`In GDScript `, this is achieved +using the ``class_name`` keyword at the top of a script. This page describes how +to achieve the same effect in C#. - Global classes show up in the *Add Node* and *Create Resource* dialogs. - If an :ref:`exported property ` is a global class, the @@ -22,6 +25,12 @@ Global classes are registered with the ``[GlobalClass]`` attribute. { } +.. warning:: + + The file name must match the class name in **case-sensitive** fashion. + For example, a global class named "MyNode" must have a file name of + ``MyNode.cs``, not ``myNode.cs``. + The ``MyNode`` type will be registered as a global class with the same name as the type's name. .. image:: img/globalclasses_addnode.webp @@ -84,8 +93,7 @@ will let you create and load instances of this type easily. .. warning:: The Godot editor will hide these custom classes with names that begin with the prefix - "Editor" in the 'Create New Node' or 'Create New Scene' dialog windows. The classes - are available for instantiation at runtime via their class names, but are - automatically hidden by the editor windows along with the built-in editor nodes used + "Editor" in the "Create New Node" or "Create New Scene" dialog windows. The classes + are available for instantiation at runtime via their class names, but are + automatically hidden by the editor windows along with the built-in editor nodes used by the Godot editor. -