UI Elements not stretching properly

I wanted to make a simple platformer touch input for Android, and thought it would really easy to make this as UI buttons now with the new UI by making them invisible… Well, instead of it being really simple it happened to be bonkers. I’ve put my buttons to stretch and placed them on canvas, now intuitively I thought that the buttons should literally stretch together with height and width… But they don’t!

I set them up properly, anchors on edges, stretch…

But when I reduce the width of the game window, the buttons get smaller by double, instead of keeping with the width of the canvas. At one point buttons will flip around after they pass into negative width. On the other hand when I increase the size, the stretch and eventually overlap. The same goes if you put buttons vertically.

Eventually, I wanted to resize the buttons from code, but the TransformRect.rect is read only, unfortunately.

I have spent 2 hours trying to figure this out, but I can’t… Is there something I am doing wrong?

Hi. The stretch options don’t work the way you describe. Have a look at the page in the manual bundled with beta 18 called “Basic Layout”.