Open P5ina opened 3 days ago
It's not only about the pressed method, but also _toggled
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
If anything, _pressed()
is useful for prototyping when you can't be bothered to write all the signal connection boilerplate 🙂
I agree, my proposal was about making this things more consistent.
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.