UI resolution issues - Build EXE

I finally came back to Unity after 4 years absence, I learned the new UI system in about an hour, seems awesome.

However, I’ve just built some UI buttons that work fine on all resolutions in the editor, but when I publish a windows EXE, one of the buttons you have to hover right into the middle of it (edges ignored), and the other you have to hover to the left of it.

now I’ve just figured out this works fine in a windowed mode, and in some of the resolutions, but for example I’ve a 1920x1080 monitor and if I launch in 1280 x 1024 the button dimensions don’t seem to be right - I mean they look okay, but I can’t click on them properly, it’s as if the hitbox is in the wrong shape and/or size.

Now I assume this is something to do with aspect ratio, but it works in all aspect ratios etc in the editor - so do I just have to test each resolution and disallow any aspect ratios that break?

This seems counter-intuitive - there must be something simple I’ve missed…

Any ideas?

I really appreciate any assistance given! :smiley:

Windows 7 x64 build

In the ‘canvas scaler’ component of your buttons’ parent canvas, set the ‘UI Scale Mode’ to ‘Scale with screen size’.

Then provide a reference resolution[Your default resolution on which you’ve built it], and set the ‘Match’ value to 1.

Your elements should scale proportionally now. Hope it helps :slight_smile:

Do you have a canvas scaler? If you don’t have one you can try adding it and set it to something like this. 47826-canvas-scaler.png

Also, make sure the placeholder for each canvas elements is just right for their intended size or else they will overlap and the object sorted in the back will not detect any click or touch input.

Sorry - it was a total n00b /lazy question, now that I have a few minutes I can see it’s all covered in the following docs properly:

in particular the Canvas Scaler doc says this:

If the current screen resolution has a different aspect ratio than the reference resolution, scaling each axis individually to fit the screen would result in non-uniform scaling, which is generally undesirable. Instead of this, the ReferenceResolution component will make the Canvas resolution deviate from the reference resolution in order to respect the aspect ratio of the screen. It is possible to control how this deviation should behave using the Screen Match Mode setting.

In various unity versions, including 5.3.1, the canvas scaler doesn’t scale properly in full-screen, non-native resolutions. It’s a known bug seemingly related to multiple displays

One solution that worked for me was to disable the “Use Dx11” option in Player Settings, that sorted it all out for me.