Godot Version
4.2.2
Question
I made a grid container a child of a panel and put two buttons in it. I set the columns to 2 and it moved the second button over to the right which is good.
Then i realized i might want to use touchscreen buttons instead so i made the same set up with touch buttons but it doesn’t move the second button to the right.
Any ideas why not?
The issue is that a Button inherits Control
(green icon!), but TouchScreenButton inherits Node2D
(blue icon). Your GridContainer is also green (Control). Layout containers only affect other nodes inheriting from Control.
You are basically mixing two worlds. One is UI (green) and the other is 2D gameplay (blue). They are separate from each other, although they are both 2D 
Luckily, I believe a normal Button will work just as well on mobile! You don’t have to worry about TouchScreenButton for your UI on mobile devices. It’s use case is a little different - it’s described just on top of the docs:
Ooohh that makes sense. I should have noticed the color difference lol. Thanks for the help!
1 Like