Why does an instantiated scene not activate buttons when clicked?

4.1.1

I have a preloaded 2D scene with buttons in it, they are connected to the scene’s main script via the pressed() connection. When I run this scene on it’s own, the function works correctly, but when the scene is instantiated, the buttons no longer activate their connected signal.

I have already tried to use .connect() to reconnect the signal in the _ready() function for the scene’s script, but that didn’t work either for the instantiated scene. Does anybody know why this happens? Hopefully, its a simple Godot thing that I just need to click a checkbox for which I somehow haven’t heard about.

Can you show your script and/or scene tree?

I’m guessing the input doesn’t reach the buttons, depending on what else is in the tree around where you instantiated your scene. Do the buttons visually react at all?

Other Control nodes needed ignore Mouse,
obraz
For controller you needed grab focus in control element

I worked it out, I was adding the instantiated scene as a child of the root node, so it was separate from the main scene. Once I changed it to be a child of the main scene, the connections worked correctly.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.