0 votes

I want to create a global script in which I can establish variables, which can be used in every other script.

in Engine by (12 points)

2 Answers

+1 vote
by (21,714 points)

Would it make more sense to link to the "stable" version? Not sure what users do here.
https://docs.godotengine.org/en/stable/tutorials/scripting/singletons_autoload.html

0 votes

Currently the steps are:

  1. Via menu option Project go to Project Settings > AutoLoad tab.
  2. Add your script.
  3. Give the script a self-documenting name, like: GlobalSettings.
  4. Access it via $/root/GlobalSettings.

But as suggested by @kidscancode, read the docs:
https://docs.godotengine.org/en/stable/tutorials/scripting/singletons_autoload.html

by (42 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.