Using Screen.SetResolution(width, height, windowMode); , how might I stretch the image to match the monitor size? I've noticed this problem occurs both with this line of code and also the default unity configuration launcher.

No body seems to discuss this issue which is odd to me.

Unity not stretching image

  • 1
    \$\begingroup\$ Well, viewports stretches automatically to fill screen, without any extra coding. I can't get the point of your question. \$\endgroup\$ Dec 11, 2015 at 14:54
  • \$\begingroup\$ is the image a UI component ? \$\endgroup\$
    – Uri Popov
    May 10, 2016 at 9:31

2 Answers 2


If I was using this as a background image for instance. I would use a larger resolution so it would scale down on devices with lower res rather than up and pixelate.

  • \$\begingroup\$ I dont mind to up and pixilate if the user wants to use lower resolution on higher res monitor. I'd just like to stretch the image to fit the screen. \$\endgroup\$
    – Euthyphro
    Sep 12, 2015 at 1:46
  • \$\begingroup\$ Have you tried to refresh the screen after setting the res? or force the image to Screen.height Screen.width? If you force a resolution smaller than what the device is set to the area that your arrows are in the example image will be very undesirable. Is this image in a UI canvas and still not stretching properly? \$\endgroup\$ Sep 12, 2015 at 14:05

You have to set Image anchoring and require to mess with canvas Scalar.

And you have to remember that

UI elements are by default anchored to the center of the parent rectangle. This means that they keep a constant offset from the center.

If the resolution is changed to a landscape aspect ratio with this setup, the buttons may not even be inside the rectangle of the screen anymore.

As it is a long topic, i will recommend you the unity official tutorial Designing UI for Multiple Resolutions

  • \$\begingroup\$ I don't think this answers the question. The user here has reduced the resolution of the screen, so what you're seeing in the image is not just a sprite anchored to the top of a canvas. That's the Unity splash screen rendering to the "full" 800x600 resolution, but instead of stretching this to fill the actual display pixels, the graphics driver or OS is letterboxing it instead. I've seen this happen with laptop displays especially. \$\endgroup\$
    – DMGregory
    May 2, 2017 at 12:15
  • \$\begingroup\$ Maybe we should ask for more details about the questions.user didn't mention it is splash screen. mostly these kind of problem anchors due to wrong anchoring, according to my experience. \$\endgroup\$ May 3, 2017 at 4:40
  • \$\begingroup\$ The question literally shows a picture of the standard Unity splash screen circa 2015 when the question was asked. The user specifically asks about changing the rendered screen resolution using SetResolution or by selecting a lower resolution in the Unity launcher, and ensuring the result fits the extents of the monitor. At no point do they mention UI canvases. You're absolutely right that anchoring problems are common, but this is not asking about that. \$\endgroup\$
    – DMGregory
    May 3, 2017 at 9:38

You must log in to answer this question.

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