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\$
3
  • \$\begingroup\$ What is your value of Match in editor? It determines, what will be used as reference when scaling. \$\endgroup\$
    – lentinant
    Commented Dec 7, 2016 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\$ Commented Dec 7, 2016 at 9:06
  • \$\begingroup\$ show your editor screenshot \$\endgroup\$ Commented Sep 20, 2017 at 10:05

3 Answers 3

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.

\$\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.).

\$\endgroup\$
5
  • \$\begingroup\$ canvas scalar is supposed to scale it properly. i tried changing the resolution but it didnt help. \$\endgroup\$ Commented Dec 7, 2016 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\$ Commented Dec 7, 2016 at 9:54
  • \$\begingroup\$ P.S. I can't comment on the answer but can comment here, Strange. \$\endgroup\$ Commented Dec 7, 2016 at 9:54
  • \$\begingroup\$ ss is from the device. \$\endgroup\$ Commented Dec 7, 2016 at 16:06
  • \$\begingroup\$ the thing is when i increase the resolution it becomes more smaller. \$\endgroup\$ Commented Dec 7, 2016 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

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .