So I want to Override a build-in function to adjust it to my needs, but I can't get it to work or find any solutions, the Override just doesn't get called.
Details:
I want to extend the select() method of an OptionButton to emit a signal every time an item is selected. I'm just assuming that this is the method that is always called when ANY changes happen to the selected item by ANY sources, for example when there isn't an item added initially (selected = -1), but when I add an item, it is selected automatically (selected = 0). In these kind of scenarios I want that custom signal to be emitted too. Is there any other way to make this work besides my idea if that does not work?
Thanks!
How to override native function?
Asked Answered
The select function isn't virtual as you can see from the source: https://github.com/godotengine/godot/blob/master/scene/gui/option_button.h#L122
I assume that means it can't be overriden.
Furthermore the code indicates that this assumption
I'm just assuming that this is the method that is always called when ANY changes happen to the selected item by ANY sources
is wrong.
Can be your solution using an Auto-load script? Not sure about that override but with autoload you can store variable and functions that works and can be manipulate in any part of your game.
Thessalonians Hmmm okay, thanks for the information! Gonna have to find a workaround then
© 2022 - 2024 — McMap. All rights reserved.