Search Unity

Increase window size without increasing resolution?

Discussion in 'General Graphics' started by SgtSargeMcFly, Jul 5, 2021.

  1. SgtSargeMcFly

    SgtSargeMcFly

    Joined:
    May 4, 2020
    Posts:
    20
    Hi, all. I'm toying around with designing PS1-style games because I really like the compact low-res look. A 320x240 window size is great for what I'm doing.

    upload_2021-7-5_17-33-58.png

    But yea, something that small can be annoying to focus on for a while so I want to give the option to increase the window size without actually increasing the resolution of the game, like you can do in the scene view.

    upload_2021-7-5_17-36-20.png

    Like this.

    I know how to set the Window size in the build settings menu but not how to adjust it with a script. Can anyone provide some insight? For that matter, is having a scaled-up window even more resource-efficient than a higher resolution? If anyone can offer some advice I'd be really thankful.
     

    Attached Files:

  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Replace your main camera's render target with a render texture of the resolution you want.

    This will make it not render to the screen though, which you can fix by swapping to a render texture using c# on pre and post render and using a
    Graphics.Blit(myRT, null)
    to render it back to the frame buffer, or by using two cameras and have the second camera just render a quad with your first camera's render texture on it.

    There are also assets on the store that do all of this for you if you want.