- Home /
Unity4.6 : No scaling UI, Content vanishes in a smaller viewport
I've been building a game over the past few days, purely using the new UI tools - Canvas, nested images/sprites etc.
With my game viewport set to 1280x720, everything went great - until I exported at 1080p to see how it looked.
Unfortunately, it seems as though Unity does not scale the UI; at 1080p, it simply scales down the 1280x720 content.. and expands the viewport to fill the rest of the area. Which basically leaves around 1/3 of the screen completely blank.
Worse still, if I lower the resolution, it just cuts off everything that doesn't fit; so for exporting at 800x450 (standard 16:9 res for portals like Kongregate), around 1/3 of the game window vanishes completely. Further to this, if you edit the html, you can manually scale how large of a viewport you want.
I'm guessing this is something really mundane, as I'd be fairly surprised if Unity lost the ability to scale content :) unfortunately, I can't see anything glaringly obvious - but I've noticed that the root Canvas' width/height is matching whatever camera settings I input. Would someone be able to point me in the right direction of getting the canvas to scale appropriately?
edit: Seems I've gotton it fixed up for 16:9 resolutions by setting the canvas scaler to "expand" - however, if I leave the 16:9 resolution set, the viewport again expands/contracts and either reveals blank content, or cuts off content.
Answer by Srki94 · Dec 24, 2014 at 01:53 AM
In your Canvas gameObject, there is an component named "Canvas Scaler". Set "Ui Scale Mode" field to "Scale With ScreenSize".
Then go back to Scene and set up anchors for each UI element that you have. You will see that it will scale itself and respect that anchor no matter what resolution or ratio!
Use that canvas rect from Scene view as your representation of screen of device.
Edit : I just realized that this happens for you only at 1080p? If so I'm sorry - I didn't understand you when I first posted, however I'd keep this one to help everyone else with scaling :) (p.s. I don't know what you test your builds at but IIRC web player is limited to 720p)
Your answer
![](https://koobas.hobune.stream/wayback/20220613174757im_/https://answers.unity.com/themes/thub/images/avi.jpg)