The "Static Instance Pattern" seems like a bit of a hack... But is it actually a legitimate and useful way to use #Godot?
https://blog.hortopan.com/you-dont-need-globals-in-godot-use-static-var
Interested to hear thoughts.
The "Static Instance Pattern" seems like a bit of a hack... But is it actually a legitimate and useful way to use #Godot?
https://blog.hortopan.com/you-dont-need-globals-in-godot-use-static-var
Interested to hear thoughts.
@ConditionalCoder in your specific example, if you ever add a second node of this type, it will override the static instance. You probably want a null check to ensure an actual singleton.
But in any case, Godot’s autoloads seem to solve the same problem in a better way.