Setting Unity to run at fullscreen 320*240 resolution

Simple question. Is it possible to set Unity to run at standard 320240 pixels, fullscreen? I set this resolution in the build settings and also tried to change it during runtime, but it seems like internally, it also displays at Windows resolution (19201080 in my case), making everything look blurry. Interestingly, when printing the current screen resolution via Debug.Log, it says 320*240.

I’m not asking for anything related to the camera, by the way. I want to (full-)screen to display at 320*240.

This isn’t a question about a setting in Unity but if your used hardware and drivers support that video mode. Many modern cards do no longer support things like quater VGA. The lowest video mode i can select on my hardware is 800x600. However it seems it’s mainly an artificial limitation of the driver. Anyways it’s nothing you can enforce or fix in Unity.

Also keep in mind that a monitor can only display multiples of the native resolution without any interpolation issues. For example my native resolution is 1920 x 1080. To display 320x240 on that monitor one pixel would be represented by 6x4.5 native pixels. So it doesn’t translate one-to-one and you would get some issues every second line.

edit

I quickly created a simple script that when attached to a camera will create a low resolution effect by dynamically creating a render texture of the specified size and assign it to the camera. The resulting rendertexture is simply drawn to the screen in OnGUI and based on the “stretch” setting either draw the texture fullscreen or automatically letterbox / pillarbox the image in the center.

using UnityEngine;

public class LowRes : MonoBehaviour
{
    public int targetWidth;
    public int targetHeight;
    public bool stretch = false;
    public bool clearBK = true;

    private RenderTexture tex;
    private Camera cam;
    private Rect screenRect;

    private void Start()
    {
        screenRect = new Rect(0, 0, Screen.width, Screen.height);
        cam = GetComponent<Camera>();
        tex = new RenderTexture(targetWidth, targetHeight, 24);
        tex.filterMode = FilterMode.Point;
        cam.targetTexture = tex;
    }
    public Vector3 ScreenToCamPoint(Vector3 aScreenPoint)
    {
        aScreenPoint.x -= screenRect.x;
        aScreenPoint.y -= screenRect.y;
        aScreenPoint.x *= targetWidth / screenRect.width;
        aScreenPoint.y *= targetHeight / screenRect.height;
        return aScreenPoint;
    }

    void OnGUI ()
    {
        if (Event.current.type != EventType.Repaint)
            return;
        screenRect = new Rect(0,0,Screen.width, Screen.height);
        if (!stretch)
        {
            float sa = screenRect.width / screenRect.height;
            float ta = (float)tex.width / tex.height;
            if (sa > ta)
            { // pillar box
                screenRect.width = screenRect.height * ta;
                screenRect.x = (Screen.width - screenRect.width) * 0.5f;
            }
            else
            { // letter box
                screenRect.height = screenRect.width / ta;
                screenRect.y = (Screen.height - screenRect.height) * 0.5f;
            }
        }
        if (clearBK)
            GL.Clear(true, true, Color.black);
        GUI.DrawTexture(screenRect, tex);
    }
}

Unfortunately inside the editor Unity will display a centered info box in the game window telling you that there is no active camera rendering to this screen, which is technically correct but annoying as this message appears above the actual image. Since this is just an effect for the final game you may simply add another camera with a culling mask of “Nothing”. Also note that since the rendertexture camera has a smaller resolution than the actual screen size, any screen to world projection will be wrong when using that camera. That’s why i also added the conversion method “ScreenToCamPoint”. You can feed in Input.mousePosition and it gives you the proper screen space position you need for ScreenToWorldPoint / ScreenPointToRay / …

Of course there might be other solutions but it seems to work pretty well. The advantage above using a postprocessing effect is that the actual rendered resolution is 320 x 240 so the actual rendering overhead is way smaller.