- Home /
Divide resolution and stretch to screen/window/canvas
For free-supported platforms (mobile&pc), is there a way to divide the player resolution by 2, 3 or 4, and stretch rendered frame to the screen/window/canvas? This would take less pixels to process (alpha, pixel shaders...), and by the way make pixel-art games easier than scaling everything.
Note : choose a fixed resolution or ratio is not my goal at all, and I use the free version of Unity3D.
Answer by johne5 · May 22, 2013 at 04:11 PM
I'm sure you've tried "Screen.width / 2" and "Screen.hight / 2"
I use ScaleToFit the strech my images to the full size of the screen.
GUI.DrawTexture(Rect(0,0,Screen.width,Screen.hight), aTexture, ScaleMode.ScaleToFit);
Yes, I've found Screen.SetResolution(), but not sure if it's working for all mobile platforms... need to test.
I don't use GUI to draw my objects... (I thought it was for interface stuff?).
So I currently tried on a standalone project : it doesn't work exactly well on fullscreen (Can't go below 640x480), but in windowed mode I didn't found how to do it at all without get a smaller window. For example, I choosed 800x600 in the list, then in a script I divide this by two, but the window gets smaller. I want it to keep its size and just display a stretched rendering... And how about the web player?
Another side question I have is : how to disable pixel smooth while using this technique, knowing that it's not textures, but the final screen that is stretched?