-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Remove _pressed
virtual method in BaseButton.
#10767
Comments
It's not only about the pressed method, but also |
The virtual methods are very useful for things like extensions, removing this would break compatibility and make it more annoying to work with buttons in extensions especially, having to swap to using signals, signals are also worse for performance than virtual methods If anything I'd say we should add virtual methods in more places |
_pressed
virtual method in BaseButton.
If anything, |
I agree, my proposal was about making this things more consistent. |
Note that virtual methods differ from signal handlers functionally and semantically. Signals can be disconnected ( In my opinion, virtual methods are better suited for overriding internal functionality, although you still sometimes have to use self-connection of a signal if the virtual method is not provided by the engine. While signals are primarily intended to notify Imagine that you are designing a |
Closing proposal, considering the explanation of the existence of virtual methods for buttons. |
Describe the project you are working on
A 2D topdown interactive story game
Describe the problem or limitation you are having in your project
When I saw the virtual method
_pressed
in BaseButton, I thought that the functionality for the button should be added by overriding this method. And then I didn't find the_area_entered
method in Area2D. But both had a signal. Which raised the question of why the button has a virtual method_pressed
at all. Or if it should be, then why doesn't Area2D have a similar method? I find this very confusing, especially for beginners.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Remove
_pressed
virtual method in BaseButton.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Without using
_pressed
it will look like this:If this enhancement will not be used often, can it be worked around with a few lines of script?
It's very easy to work around this problem, by just not using
_pressed
.Is there a reason why this should be core and not an add-on in the asset library?
It can't be done using an addon.
The text was updated successfully, but these errors were encountered: