【Unity】Setting Game Resolution and Fullscreen Mode in Unity

Created: 2025-12-07

Resolution settings let players customize their experience. Learn how to use the Screen class for dynamic resolution changes, fullscreen mode switching, and default build settings configuration.

Overview

When releasing PC games, players use monitors of varying sizes and capabilities. Providing options to adjust game resolution and display mode (fullscreen/windowed) is essential for a good user experience.

Unity's Screen class API makes it easy to control these settings from scripts. You can also configure default launch resolution and whether to show a resolution selection dialog in build settings.

This article covers dynamic resolution and fullscreen mode changes using the Screen class, plus Player Settings configuration for builds.

Dynamic Settings with the Screen Class

The Screen class provides static properties and methods for getting screen information (width, height) and changing settings. As a static class, you can access it directly from anywhere using Screen.property.

Getting Current Resolution

Use Screen.width and Screen.height properties to get current screen dimensions in pixels.

using UnityEngine;

public class ScreenInfo : MonoBehaviour
{
    void Start()
    {
        int screenWidth = Screen.width;
        int screenHeight = Screen.height;

        Debug.Log("Current resolution: " + screenWidth + "x" + screenHeight);
    }
}

Setting Resolution and Fullscreen Mode: SetResolution()

The easiest way to change resolution and display mode simultaneously is Screen.SetResolution().

Screen.SetResolution(int width, int height, bool fullscreen)

  • width: Desired screen width in pixels.
  • height: Desired screen height in pixels.
  • fullscreen: true for fullscreen mode, false for windowed mode.

Here's a simple implementation that changes resolution when UI buttons are clicked:

using UnityEngine;

public class ResolutionController : MonoBehaviour
{
    // Set to 1920x1080 fullscreen
    public void SetFullScreen1080p()
    {
        Screen.SetResolution(1920, 1080, true);
        Debug.Log("Resolution set to 1920x1080 fullscreen.");
    }

    // Set to 1280x720 windowed
    public void SetWindowed720p()
    {
        Screen.SetResolution(1280, 720, false);
        Debug.Log("Resolution set to 1280x720 windowed.");
    }
}

Connect these methods to Button component OnClick() events on your Canvas to implement click-to-change resolution functionality.

Toggling Fullscreen Mode Only

To switch between fullscreen and windowed mode while keeping current resolution, assign directly to the Screen.fullScreen property.

public void ToggleFullScreen()
{
    // Invert current fullscreen state
    Screen.fullScreen = !Screen.fullScreen;

    if (Screen.fullScreen)
    {
        Debug.Log("Switched to fullscreen mode.");
    }
    else
    {
        Debug.Log("Switched to windowed mode.");
    }
}

Advanced Control with FullScreenMode Enum

The boolean third argument (bool fullscreen) is an older format. Modern Unity commonly uses the FullScreenMode enum for more detailed display mode options.

Screen.SetResolution(int width, int height, FullScreenMode mode)

FullScreenMode options include:

  • FullScreenMode.ExclusiveFullScreen: Traditional exclusive fullscreen. Best performance but Alt+Tab switching may be slow.
  • FullScreenMode.FullScreenWindow: Borderless fullscreen window. Looks like fullscreen but is actually a full-screen window. Smooth switching—the standard for modern games.
  • FullScreenMode.MaximizedWindow: (macOS only) Maximized window.
  • FullScreenMode.Windowed: Standard windowed mode.
public void SetBorderlessFullScreen()
{
    // Get current monitor's maximum resolution
    Resolution currentRes = Screen.currentResolution;
    // Set to borderless fullscreen
    Screen.SetResolution(currentRes.width, currentRes.height, FullScreenMode.FullScreenWindow);
}

Default Build Settings (Player Settings)

Configure default launch resolution and behavior in Edit > Project Settings > Player under Resolution and Presentation.

  • Fullscreen Mode: Select default fullscreen mode at launch (Exclusive, Borderless, etc.).
  • Default Screen Width / Height: Set default width and height when launching in windowed mode.
  • Display Resolution Dialog: (Legacy feature) When Enabled, shows Unity's standard resolution selection dialog at launch. Modern games typically handle this in-game options screens, so this is usually set to Disabled.

Summary

Resolution settings are essential features, especially for PC games.

  • Use the Screen class to get screen information and change settings.
  • Screen.SetResolution(width, height, mode) dynamically changes resolution and display mode.
  • FullScreenMode enum enables detailed mode selection including borderless fullscreen.
  • Player Settings configure default launch settings.

Implement an options screen with common resolution presets (1280x720, 1920x1080, 2560x1440, etc.) and fullscreen/windowed toggles that call Screen.SetResolution to provide comfortable play environments for more players.