So I have a texture button in my pause screen scene that has no code attached to it but some print statements when it is pressed. When I click the button, the print does not happen. There's also another texture button that is a sibling of the problematic one that works fine. What is the issue?
TextureButton just not doing anything?
Can you upload a minimal reproduction project that has the problem? That's often the quickest way to get a solution. If you do that, specify the exact Godot version you're using.
i suggest to conenct signals in code not in the UI.. it gets hairy real fast when using UI.
just in the ready() function you connect them to your methods/functions.
func _ready():
var timer = get_node("Timer")
timer.timeout.connect(_on_timer_timeout)
in your case as it is build in signal you just use that built in signal name
func _ready():
button_down.connect(_on_timer_timeout)
func _on_timer_timeout():
pass
DaveTheCoder I tried to do a minimal reproduction, just coped and pasted the scene file into another project and the button started to work?
In at least one case, I've fixed a problem like that by disconnecting and reconnecting a signal.
Or you could try kuligs2's suggestion of connecting the signals in code rather than using the Inspector. I normally connect signals that way.
- Edited
DaveTheCoder I tried disconnecting them and doing it in code instead and even completely deleting and remaking the scene but I'm still having the same issue.
EDIT: Just found out that if I switch the positions of the buttons in the scene tree only the button on top in the tree works. Why does this happen?
- Edited
Camp pause screen scene
Are you pausing the game as described here?
https://docs.godotengine.org/en/4.4/tutorials/scripting/pausing_games.html
If so, are you setting the Process Mode correctly for the nodes that you want to be active when the game is paused?
In addition, this is often useful to debug non-working controls:
bottom panel / Debugging / Misc / Clicked Control
DaveTheCoder Yes, the pause screen node is set as "always" and all its children are set as "inherit".
What about Debugging / Misc / Clicked Control? Does that behave differently for the two buttons?
IDK man, i recreated this based on your posts and image.. it work on my 4.3 stable
I even connected the signals through UI
I didnt change any process properties.. all default values.. i just played around with anchors and expand things.. the label doesnt want to show up (always under the button) when its not expanded.. idk why..
DaveTheCoder Yes, when I click the bottom button it shows that the button was clicked but when I click the top button it says that the VBoxContainer that the buttons are in was clicked.
You said earlier that if you switch the positions of the buttons in the scene tree, only the first one works. Is that still true, using Debugging / Misc / Clicked Control?
You might try adding a third button, and see which of the three buttons' clicks is detected. You don't need to add code, just use Debugging / Misc / Clicked Control.
Also look at the controls in the 2D view, and ensure that it looks reasonable.