33C# global classes
44=================
55
6- Global classes (also known as named scripts) are types registered in Godot's editor so they can be used
7- more conveniently.
6+ Global classes (also known as named scripts) are types registered in Godot's
7+ editor so they can be used more conveniently.
8+ :ref: `In GDScript <doc_gdscript_basics_class_name >`, this is achieved
9+ using the ``class_name `` keyword at the top of a script. This page describes how
10+ to achieve the same effect in C#.
811
912- Global classes show up in the *Add Node * and *Create Resource * dialogs.
1013- If an :ref: `exported property <doc_c_sharp_exports >` is a global class, the
@@ -22,6 +25,12 @@ Global classes are registered with the ``[GlobalClass]`` attribute.
2225 {
2326 }
2427
28+ .. warning ::
29+
30+ The file name must match the class name in **case-sensitive ** fashion.
31+ For example, a global class named "MyNode" must have a file name of
32+ ``MyNode.cs ``, not ``myNode.cs ``.
33+
2534The ``MyNode `` type will be registered as a global class with the same name as the type's name.
2635
2736.. image :: img/globalclasses_addnode.webp
@@ -84,8 +93,7 @@ will let you create and load instances of this type easily.
8493.. warning ::
8594
8695 The Godot editor will hide these custom classes with names that begin with the prefix
87- "Editor" in the ' Create New Node' or ' Create New Scene' dialog windows. The classes
88- are available for instantiation at runtime via their class names, but are
89- automatically hidden by the editor windows along with the built-in editor nodes used
96+ "Editor" in the " Create New Node" or " Create New Scene" dialog windows. The classes
97+ are available for instantiation at runtime via their class names, but are
98+ automatically hidden by the editor windows along with the built-in editor nodes used
9099 by the Godot editor.
91-
0 commit comments