瀏覽代碼

Clarify creating a global in Singletons (Autoload) (#10416)

The code below to be added to scene 1 and 2 didn't say how to define the global variable, and neither did this, so I fixed it

---------

Co-authored-by: tetrapod <[email protected]>
fearwalia 7 月之前
父節點
當前提交
d5b8afb77b
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      tutorials/scripting/singletons_autoload.rst

+ 3 - 1
tutorials/scripting/singletons_autoload.rst

@@ -152,7 +152,9 @@ The next step is to add this script to the autoLoad list.
 Starting from the menu, open
 Starting from the menu, open
 **Project > Project Settings > Globals > Autoload** and
 **Project > Project Settings > Globals > Autoload** and
 select the script by clicking the browse button or typing its path:
 select the script by clicking the browse button or typing its path:
-``res://global.gd``. Press **Add** to add it to the autoload list:
+``res://global.gd``. Press **Add** to add it to the autoload list
+and name it "Global", which is required for scripts to access it
+by the name "Global":
 
 
 .. image:: img/autoload_tutorial1.webp
 .. image:: img/autoload_tutorial1.webp