- Home /
Issue with UI button positioning
I'm using the new Untiy canvas tools to create buttons. I know with the old GUI layout, a commom problem was positioning the GUI using the GUI pixel offset rather than its local x,y,z. But this is not the case here. In my editor it looks like this:
Then when I play it in full screen mode:
The positioning is way off, it's the same on my tablet too, does anyone know how I can fix this?
have you tried
`public static void AutoResize(int screenWidth, int screenHeight)
{
Vector2 resizeRatio = new Vector2((float)Screen.width / screenWidth, (float)Screen.height / screenHeight);
GUI.matrix = $$anonymous$$atrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(resizeRatio.x, resizeRatio.y, 1.0f));
}`
Cheers @$$anonymous$$ayank Ghanshala I will give that a go, thanks :) @Landern, I didn't, still new to these new UI tools but I just found the ReferenceResolution there so i'll try it out, thanks
@Landern, many thanks friend, can't believe how easy that was. If you convert your comment, i'll select it as an answer
Answer by Landern · Sep 05, 2014 at 02:03 PM
Have you added a ReferenceResolution component to your canvas?