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 when their parent is a Grid Container, they stop working : they are added as expected in a grid like layout 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 grid container.

The thing is, when I use right click on my Grid Container node to change its type to any other control node, the buttons now work (though nothing else has changed in the scene).

So to summarize, the buttons work as long as their parent is anything but a Grid Container. 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). The button mouse filter is always set to "stop".

I should also add that every other control work in the scene, and the same buttons work fine when I change my grid container node to a simple control node

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.