3 ms·
Great summary. You can certainly have Singletons in Godot using GDScript [1]. [1] https://docs.godotengine.org/en/stable/tutorials/scripting/singletons_autolo
by rmbyrro 5y ago
Great summary.
You can certainly have Singletons in Godot using GDScript [1].
[1] https://docs.godotengine.org/en/stable/tutorials/scripting/singletons_autoload.html https://docs.godotengine.org/en/stable/tutorials/scripting/s...
- KronisLV 5y ago> You can certainly have Singletons in Godot using GDScript [1]. That is somewhat true in that you can get most of the way there with some pitfalls, from the documentation: > Act like a singleton, since GDScript does not support global variables by design. (of course, it's their language so they can design it however they wish) The note sheds more light on how it works: > Godot won't make an AutoLoad a "true" singleton as per the singleton design pattern. It may still be instanced more than once by the user if desired. It's still nice that they added the AutoLoad section with the ability to use the checkbox to enable referencing your variables with the class name qualifier vs having to get the singleton node first. Truthfully, it should cover most use cases out there with no issues. Also, Godot's docs are actually improving at a pretty nice rate!