0
\$\begingroup\$

I am trying to make my canvas auto resize to any screen size. These are my canvas scalar settings:

UI mode: change with screen size

match height and width

reference resolution: 600x800

I looked up in various tutorials where they say to set it to "change with screen size" and "match height and width" so I did that but still it's not fitting. The weird thing is that it fits horizontally but not vertically.

screenshot: https://s15.postimg.org/ue99zehkr/Screenshot_20161207_132731.png

\$\endgroup\$
  • \$\begingroup\$ What is your value of Match in editor? It determines, what will be used as reference when scaling. \$\endgroup\$ – lentinant Dec 7 '16 at 8:42
  • \$\begingroup\$ i tried 0, 0.5 and 1 but i get best fit at 0. at 1 everything gets zoomed in. \$\endgroup\$ – Mohit Saxena Dec 7 '16 at 9:06
  • \$\begingroup\$ show your editor screenshot \$\endgroup\$ – Manoj Balaji M Sep 20 '17 at 10:05
1
\$\begingroup\$

Is the canvas scaler set to Preserve Pixel resolution? I make that mistake sometimes, that's the default and there's a setting for Scale with Screen.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

I can't comment because I don't have sufficient KP. So, i will just write here

Given the information provided by you, It seems like you're setting the resolution in Portrait mode (height > width). And from looking at the screenshot, it seems like the game is set up on Landscape mode, which is why it's showing like this. So, try changing the reference resolution to a landscape one (800 x 480, 854 x 480 etc.).

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ canvas scalar is supposed to scale it properly. i tried changing the resolution but it didnt help. \$\endgroup\$ – Mohit Saxena Dec 7 '16 at 9:38
  • \$\begingroup\$ Well, Canvas scalar can't scale it properly if the reference is not set correctly. However, as you say, changing the reference didn't worked, we'll have to try something else. Is the screenshot taken from Device or from Unity Editor? \$\endgroup\$ – Aditya Yadav Dec 7 '16 at 9:54
  • \$\begingroup\$ P.S. I can't comment on the answer but can comment here, Strange. \$\endgroup\$ – Aditya Yadav Dec 7 '16 at 9:54
  • \$\begingroup\$ ss is from the device. \$\endgroup\$ – Mohit Saxena Dec 7 '16 at 16:06
  • \$\begingroup\$ the thing is when i increase the resolution it becomes more smaller. \$\endgroup\$ – Mohit Saxena Dec 7 '16 at 16:18
-1
\$\begingroup\$

Have you looked at unity anchors? These help you specify what you want to happen when the window resizes. Here's the Unity documentation on that: https://docs.unity3d.com/Manual/UIBasicLayout.html

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.