0 votes

In my scene tree, I have these buttons that I add at runtime via code. They are a packed scene made of a button node with an animated sprite attached to it. I'm adding 20 of them and I want them to be arranged in a grid layout.

The buttons by themselves work fine, and they also work fine if I add them as children of any type of control node (they are added as intended, they receive input as intended). But for some reason, they stop working when they are children of certain type of containers : this includes GridContainer and HBoxContainer, although they work with a VBoxContainer or a basic Control node. They are added as expected but they can't receive mouse input anymore.

I've tried every mouse filter, but the buttons never receive the mouse input when they are children of a GridContainer or HBoxContainer

I have no idea what's causing this, and after 2 weeks of trying, I'm out of ideas to try...
I used the debugger to check what's receiving the mouse input : when mouse filter is set to "pass" on the grid container, the grid container will receive the input (not the buttons), and when it's set to "ignore", the input will not be handled (the debugger will display the last control clicked like the input wasn't handled at all). The buttons' mouse filter is always set to "stop".

So I could just use a Vboxcontainer but I need them to be arranged in a grid layout and just using right click and the parent's node to change its type make the button unclickable again

After more testing, I found out the buttons work with every type of container as parent except four of them : GridContainer, HBoxContainer, CenterContainer and ScrollContainer. (Just using right click again to change parent node type, not changing anything else in the scene). With every other container, the buttons work as intended. What is the logic behind that?

Thank you to anyone who could help me with this

Godot version 3.5
in Engine by (14 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.