Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions tutorials/scripting/singletons_autoload.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,8 @@ in top-to-bottom order.

.. image:: img/autoload_example.webp

This means that any node can access a singleton named "PlayerVariables" with:

.. tabs::
.. code-tab:: gdscript GDScript

var player_vars = get_node("/root/PlayerVariables")
player_vars.health -= 10

.. code-tab:: csharp

var playerVariables = GetNode<PlayerVariables>("/root/PlayerVariables");
playerVariables.Health -= 10; // Instance field.

If the **Enable** column is checked (which is the default), then the singleton can
be accessed directly in GDScript, without requiring ``get_node()``:
be accessed directly in GDScript:

.. tabs::
.. code-tab:: gdscript GDScript
Expand Down