【Unity】How to Set Screen Resolution and Fullscreen Mode in Unity

Created: 2025-12-07Last updated: 2026-07-12

Resolution and fullscreen toggles are must-have options for PC games. Learn how to change resolution at runtime with Screen.SetResolution, choose the right FullScreenMode, build a resolution dropdown from Screen.resolutions, and save the player's settings.

The "Resolution" and "Fullscreen" settings you find in every PC game's options menu exist for a reason — players' monitors range from 1080p to 4K and ultrawide, so letting the player choose is a must-have feature for any PC release.

In Unity, the Screen class gives you script-level control over both. This article covers changing settings at runtime, picking the right display mode, building a resolution dropdown for your options screen, and saving the player's choice.

Illustration of resolution settings: clay monitors of various sizes lined up, with a character adjusting sliders and toggles on a settings panel to switch screen sizes and display modes

What You'll Learn

  • Changing resolution and display mode at runtime with Screen.SetResolution()
  • The differences between the four FullScreenMode values (borderless is the standard)
  • Practical: completing an options-screen resolution picker with Screen.resolutions
  • Default startup settings and saving the player's choice

Sponsored

Changing Settings at Runtime with the Screen Class

Screen is a static class, so you can use it directly as Screen.~ from anywhere.

Getting the Current State

int width = Screen.width;    // Current game screen width (pixels)
int height = Screen.height;  // Current game screen height
bool isFullScreen = Screen.fullScreen; // Whether the game is fullscreen

Changing Resolution and Display Mode: SetResolution()

using UnityEngine;

public class ResolutionController : MonoBehaviour
{
    // Switch to Full HD borderless fullscreen
    public void SetFullScreen1080p()
    {
        Screen.SetResolution(1920, 1080, FullScreenMode.FullScreenWindow);
    }

    // Switch to HD windowed mode
    public void SetWindowed720p()
    {
        Screen.SetResolution(1280, 720, FullScreenMode.Windowed);
    }
}

Hook these up to a UI Button's OnClick() and the mode switches on click. One thing to keep in mind: SetResolution takes effect at the end of the frame in which it's called. Screen.width may still return the old value immediately afterward — remembering this will save you some head-scratching.

Toggling Fullscreen Only

If you just want to switch the display mode while keeping the resolution, assigning to Screen.fullScreen is the easiest way.

public void ToggleFullScreen()
{
    Screen.fullScreen = !Screen.fullScreen;
}
Sponsored

Choosing a Display Mode with the FullScreenMode Enum

The bool-argument version of SetResolution is the legacy form; these days it's standard to specify the mode precisely with FullScreenMode.

ModeDescriptionWhen to Use
FullScreenWindowBorderless (a window stretched over the entire screen)The modern standard. Smooth Alt+Tab
ExclusiveFullScreenExclusive fullscreenWhen rendering performance matters most (Windows only)
WindowedRegular windowFor players who prefer windowed mode
MaximizedWindowMaximized windowmacOS only
Comparison of the three fullscreen modes: FullScreenWindow = borderless, the modern standard; ExclusiveFullScreen = exclusive, performance first; Windowed = a framed window

If in doubt, defaulting to FullScreenWindow (borderless) is the safe modern choice.

public void SetBorderlessFullScreen()
{
    // Go borderless at the monitor's current full resolution
    Resolution current = Screen.currentResolution;
    Screen.SetResolution(current.width, current.height, FullScreenMode.FullScreenWindow);
}

Practical: Completing the Options-Screen Resolution Picker

Whether it's an indie game for Steam or a demo on itch.io, if you ship on PC there's no getting around the options-screen trio of "resolution dropdown + fullscreen toggle + save". Let's combine the pieces from this article and finish it off.

The finished options-screen resolution picker: build a list of monitor-supported resolutions from Screen.resolutions and lay them out in a dropdown, then save the selection and the fullscreen toggle to PlayerPrefs and restore them on the next launch

The key is Screen.resolutions. If you hard-code a list like "1920x1080", "2560x1440", and so on, players can select resolutions their monitor doesn't actually support. Screen.resolutions gives you the list of resolutions the monitor actually supports.

using UnityEngine;
using System.Linq;
using TMPro;

public class ResolutionDropdown : MonoBehaviour
{
    private const string PrefKey = "ResolutionIndex";

    [SerializeField] private TMP_Dropdown dropdown;
    private Resolution[] resolutions;

    void Start()
    {
        // The same width/height appears once per refresh rate, so dedupe by size
        resolutions = Screen.resolutions
            .GroupBy(r => new { r.width, r.height })
            .Select(g => g.Last()) // Take the highest refresh rate for each size
            .ToArray();

        dropdown.ClearOptions();
        dropdown.AddOptions(resolutions.Select(r => $"{r.width} x {r.height}").ToList());

        // Restore the previous selection (or the closest match to the current resolution if none saved)
        int saved = PlayerPrefs.GetInt(PrefKey, FindCurrentIndex());
        dropdown.SetValueWithoutNotify(saved);
        ApplyResolution(saved);

        dropdown.onValueChanged.AddListener(OnResolutionSelected);
    }

    void OnResolutionSelected(int index)
    {
        ApplyResolution(index);
        PlayerPrefs.SetInt(PrefKey, index); // Save the moment it's chosen
    }

    void ApplyResolution(int index)
    {
        Resolution r = resolutions[Mathf.Clamp(index, 0, resolutions.Length - 1)];
        Screen.SetResolution(r.width, r.height, Screen.fullScreenMode);
    }

    int FindCurrentIndex()
    {
        for (int i = 0; i < resolutions.Length; i++)
        {
            if (resolutions[i].width == Screen.width && resolutions[i].height == Screen.height)
                return i;
        }
        return resolutions.Length - 1; // Fall back to the highest resolution
    }
}

For the fullscreen toggle, wire Screen.fullScreen = isOn; to a Toggle's onValueChanged and save it to PlayerPrefs the same way—and your trio is complete.

There are two key points. "Don't hard-code the options; build them from Screen.resolutions" (whether it's ultrawide or 4K, the list is generated to match that monitor automatically) and "Use SetValueWithoutNotify when restoring" (assigning directly to value fires onValueChanged, applying the setting twice on every launch). For the finer points of saving, see Getting Started with PlayerPrefs.

Default Build Settings (Player Settings)

The defaults for first launch are configured under Resolution and Presentation in "Edit > Project Settings > Player".

  • Fullscreen Mode: The default display mode at startup.
  • Default Screen Width / Height: The window size when launching in windowed mode.
  • Resizable Window: Whether players can resize the window by dragging its edges.

Bonus: Good to Know for Later

  • Not needed on mobile: On iOS/Android you generally use the device screen as-is, so there's no resolution picker UI. Instead, lowering the render resolution is a common performance lever (see Render Scale in the mobile optimization guide).
  • UI scaling is a separate problem: If your UI breaks when the resolution changes, that's a Canvas Scaler configuration issue. See the Canvas and RectTransform article.
  • Aspect ratio differences: Building against a 16:9 assumption leads to cropping or letterboxing on ultrawide (21:9) and 16:10 displays. Setting up your camera framing and UI anchors flexibly keeps you safe.
  • You can't test it in the Editor: Screen.SetResolution has no effect in the Editor's Game view (the Game view's size is managed by the Editor). Verify the behavior in an actual build.

Summary

  • Change resolution and display mode with Screen.SetResolution(width, height, FullScreenMode). It takes effect at the end of the frame.
  • Borderless (FullScreenWindow) is the modern standard for the default display mode.
  • Build the options list from Screen.resolutions instead of hard-coding it.
  • Save the selection to PlayerPrefs and restore it with SetValueWithoutNotify to avoid a double apply.
  • Set the first-launch defaults in Player Settings > Resolution and Presentation.

Once you have the trio of "resolution dropdown + fullscreen toggle + saved settings", the foundation of a PC options screen is complete. Is your game comfortable for players on ultrawide monitors, too?