Browse Source

Clarify the global registration of named_classes (#10679)

* Add a clarification about named class registry
Thibault J. 5 months ago
parent
commit
70def630be
1 changed files with 10 additions and 0 deletions
  1. 10 0
      tutorials/scripting/gdscript/gdscript_basics.rst

+ 10 - 0
tutorials/scripting/gdscript/gdscript_basics.rst

@@ -1951,6 +1951,16 @@ If you want to use ``extends`` too, you can keep both on the same line::
 
 
     class_name MyNode extends Node
     class_name MyNode extends Node
 
 
+Named classes are globally registered, which means they become available to use
+in other scripts without the need to ``load`` or ``preload`` them:
+
+.. code-block:: gdscript
+
+    var player
+
+    func _ready():
+        player = Character.new()
+
 .. note::
 .. note::
 
 
     Godot initializes non-static variables every time you create an instance,
     Godot initializes non-static variables every time you create an instance,