Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Unity and getting pixel perfect resolution in fullscreen

Discussion in 'Scripting' started by AZRetro, Jul 25, 2021.

  1. AZRetro

    AZRetro

    Joined:
    Aug 29, 2017
    Posts:
    3
    I want to set the resolution in full screen to 640 x 360. This works fine in windowed, however in full screen what Unity seems to do is set the resolution to 1366 x 768 ( my monitors highest resolution ) and then treat that like it's 640 x 360. So when I actually try to put a texture that is 640 x 360 on the screen it's blurry because it doesn't scale up to 1366 x 768 perfectly.

    This is really frustrating, and I've tried a lot of workarounds including the pixel perfect camera and using a render texture etc. None of this seems to fix the problem.

    What I would like is non-blurry pixels, so maybe if the real resolution doesn't divide perfectly into 640 x 360 there could be some black bars or something so it does fit as well as it can.

    My guess of what could be done is to detect the real resolution in full screen and then do my own adjustment to the camera's size to get the right ratio for perfectly square pixels.

    Or is there an easier way?
     
  2. bentontr

    bentontr

    Joined:
    Jun 9, 2017
    Posts:
    39
    I don't think you can set Fullscreen mode to an arbitrary resolution like 640x360 (Try 640x480). It's likely falling back to the default which is your optimal resolution as the input you are giving is not natively supported. You can try Fullscreen Windowed, that might give some different results. Try running this code snippit, it'll print out the available resolutions.


    Code (CSharp):
    1.             for (int i = 0; i < Screen.resolutions.Length; i++)
    2.             {
    3.                 Debug.Log($"{Screen.resolutions[i].height} x {Screen.resolutions[i].width}");
    4.             }
     
  3. ADNCG

    ADNCG

    Joined:
    Jun 9, 2014
    Posts:
    990
    Are your textures filter mode set to point?