-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Static signals #10680
Labels
Comments
I wonder if this would be helpful for implementing the common events bus pattern (https://www.gdquest.com/tutorial/godot/design-patterns/event-bus-singleton/)? |
Duplicate of #6851 |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the project you are working on
A tower defense game called Rift Riff and soon a sequel to my indie hit game Hidden Folks.
Describe the problem or limitation you are having in your project
I use signals on singletons quite a lot:
The (albeit minor) downside of this approach is that this requires the singleton object to be initialized and assigned. I rarely have issues with this particular pattern, but when I do it's usually when I run into tricky initialization order issues.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
It would be awesome if I could define static signals like so:
... allowing this signal to be accessible from anywhere like so – even from _init() functions in other classes before any singletons associated with the class in question have been initialized and assigned:
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
As per usual in my proposals (sorry, I'm 'just' a game dev!) I don't know enough about the engine's inner workings to say anything meaningful here.
If this enhancement will not be used often, can it be worked around with a few lines of script?
I could simply continue to use the signal through my singletons.
Is there a reason why this should be core and not an add-on in the asset library?
Not sure if it's core or GDScript, but this is part of either of those.
The text was updated successfully, but these errors were encountered: