Replies: 1 comment 3 replies
-
Such a system was proposed as an alternative to static variables, but we ended up implementing static variables before. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
v4.1.1.stable.official [bd6af8e0e]
Godot v4.1.1.stable - Windows 10.0.22621 - Vulkan (Compatibility) - Intel(R) Iris(R) Plus Graphics (Intel Corporation; 27.20.100.9664) - Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz (8 Threads)
I find that I often fall into this pattern when making games with unique instances of scenes:
player
player
variable in reference.Problem with this:
var some_node_2D : Node2D
will not provide suggestions for things likesome_node_2D.global_position
when used in other scripts.Desired feature:
some keyword that turns a script into a singleton but does not require it to be created at the start of the application unlike auto-loaded stuff. Allow other scripts to access it by name, exposing its variables and methods like auto-loaded scripts.
Attempting to access such a singleton before it has been instantiated throws relevant errors, requiring checks or sufficient foresight to prevent, but that is no different from the existing work-around.
Beta Was this translation helpful? Give feedback.
All reactions