TouchScreenButton canvas resize

Godot Version

4.2.

Question

I can’t understand the placement of buttons in the interface. If I select Button, then I can snap them to the edges of the screen and they adjust to the screen resolution and everything is ok. But if I use TouchScreenButton, then it is not possible to bind them and Canvas does not solve this problem; if the physical screen is wider, the buttons appear to the left. Can you tell me how to properly use TouchScreenButton for mobile screens?

This node inherits from Node2D. Unlike with Control nodes, you cannot set anchors on it.

There are several solutions. One is to set them as children to and position them in relation to a Camera node,

1 Like

Thank you. Yes, I read this documentation. I don’t understand why these two types of buttons are needed. Both types of buttons work on touch devices.

The answers as to “why” are actually right there in the documentation aswell.
Perhaps most important being that TouchScreenButton supports multitouch.

Yes, the difference is multi-touch. I find this decision strange. All these functions could be implemented in the Button. And Godot created another functionally limited Node.