-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify creating a global in Singletons (Autoload) #10416
Conversation
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
@@ -152,7 +152,9 @@ The next step is to add this script to the autoLoad list. | |||
Starting from the menu, open | |||
**Project > Project Settings > Globals > Autoload** and | |||
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"(this is required for scripts to access it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and name it "Global"(this is required for scripts to access it | |
and name it "Global" (this is required for scripts to access it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good once either of my suggestion or ATS's is applied.
Worth noting that "Global" (or whatever the PascalCase version of script filename is) does get autofilled when adding the script as a global. So the current text of the page, while technically incomplete, is a valid set of instructions, and this change is not strictly needed.
Added tetrapod's suggestion Co-authored-by: tetrapod <[email protected]>
@tetrapod00 added them, you could merge it now and yes, it does come in the autocomplete, but as a beginner would copy paste the code of scene 1 and 2 in the example, they might not understand that they have to do that |
Thanks, and congratulations on your first merged contribution! |
The code written below in the page 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