I’ve started playing with the new UI stuff and have a small problem.
In the editor my text elements are perfectly sized (I’ve selected the correct Windows Phone resolution in the previewer). But when I deploy to an actual device the font is all really tiny.
To get it to be the correct size on my Lumia 1520 I need to set the font size really big, which then makes it unreadable on PC.
All the rest of the UI is displayed correctly.
Thanks!
Are you testing at the same resolution in editor as the device? Related, does using a Reference Resolution component have any effect?
Yup, I’m using the correct resolution. Switching between all the available resolutions in the editor shows it pretty much the same size in all of them. And deploying to a range of Windows Phones I have from 800x480 to 1920x1080 all have the text consistently small.
I’m not sure what the Reference Resolution component is (searching didn’t lead me to anything specific).
Did you try using the Best Fit option on the Text? It seems to work for my Android build.
EDIT: The Reference Resolution script is a component you add to the Canvas and set the specific resolution.
Well, it’s more accurate to say that RR makes the UI simulate a particular resolution.
Best Fit is an option that’s best used sparingly - it is a performance hog, as in order to find the best fit, the text component has to try a bunch of different ones until it finds the right one. Besides that, having the engine setting every button’s text size slightly differently based on content will surely make your graphic design guy twitch uncontrollably. It might be a passable temporary workaround, but not a solution.
Ah, so I figured out a really stupid mistake. My PC resolution is lower than my phone, and Unity was downscaling the preview.
This means I’m now seeing it correctly in the preview window as it shows on my device.
So I guess my question is: Why does text not scale with the resolution?
Without using Best Fit (which seems like a terrible solution), is there a way to make the text roughly get bigger as the resolution gets higher? As it is currently I’d have to detect the resolution and change the font size in code, else really low resolution phones will get text flowing over the borders, while high resolution devices will have the text being tiny in their border.
Use Reference Resolution. This is exactly what it’s for.
1 Like
file:///C:/Program%20Files%20(x86)/Unity/Data/Documentation/html/en/Manual/HOWTO-UIMultiResolution.html
1 Like
Ah, thanks for the docs, got it working now!