- Home /
UI Text & Resolution Scaling
I'm developing a SNES-style RPG in 640x480 resolution and it's mostly going fine, but I'm noticing some weirdness with the text. My canvas is set to Set With Screen Size, reference resolution is set to 640x480, and I'm allowing players to choose any 4:3 aspect ratio. If I understand correctly, the text should scale to the same relative size as the resolution increases.
However, I'm seeing slight differences as you can see in the attached screenshot comparison. The shot on the left is in 800x600, the right is 640x480. There's more white space after the word "find" in 640x480 than in 800x600. The text is clearly blowing up in size with the resolution, but seemingly not at a 1:1 ratio.
Did I miss something? For the most part it's not going to matter, but my main concern is the spacing may be different enough that Unity might choose to create a new line in a different spot, potentially cutting off some of the dialogue. And I'd really rather not have to test every line in every resolution as I work. I'd appreciate any advice. Thanks!!
Answer by JxWolfe · Apr 09, 2020 at 07:35 PM
First, know this, UI sucks. Moving onward. "Set With Screen Size" doesn't exist, assuming u are talking about "Scale With Screen Size". The Reference resolution is very important, Try to use either the most common device size or the average. "Screen Match Mode" should be set to "Match Width Or Height" and the match value should be close to 0.5. As you are forcing clients into a 4:3 ratio, most UI scaling problems will disappear! Good for u. As you can't perfectly scale pixels, there will always be some issues, however they won't be major. If you are super scared about scaling issues, you could potentially put a viewport rect in the panel, then put the text under content, and add the layout feature "Content Size Fitter" thus, if unity really messes up big time, the player will at least be able to scroll through the text.
Answer by vanfriscia · Apr 09, 2020 at 09:50 PM
"Set With Screen Size" doesn't exist, assuming u are talking about "Scale With Screen Size".
Correct! My mistake, sorry about that.
"Screen Match Mode" should be set to "Match Width Or Height" and the match value should be close to 0.5.
Yes, I'm set to Match Width Or Height. I tried playing with the match value and it didn't seem to change anything (it's currently set to 0). Unity's documentation for it states: "Scale the canvas area with the width as reference, the height as reference, or something in between." I don't really get it. I'll gladly set it to .5 as you had suggested since it doesn't seem to make a difference anyway, but I wish I understood what it does. Knowledge is power :)
As you can't perfectly scale pixels, there will always be some issues, however they won't be major.
I'm reassured to hear you say that! Again, my only real concern would be if it would try and change the automatic line breaks - that would be bad. I don't care if they look slightly different, and I have enough padding on the sides that it should stay within the bounds of the image box. If you're reasonably confident that this shouldn't be an issue for my situation, then I may just move forward as is.
Thanks for the advice! If you have anything else to add I'll keep listening :)
Screen $$anonymous$$ath $$anonymous$$ode is really just for changing screen rations. Having someone play 4:3 and another on 5:2 needs special cases.