TMP UI occluded after SetResolution(1920,1440,true) in Windows build; 640×480 / 1280×720 work fine, Editor all resolutions normal
23:31 03 Jul 2026

TMP UI occluded after SetResolution(1920,1440,true) in Windows build; 640×480 / 1280×720 work fine, Editor all resolutions normal (Unity 2022.3.22f1 Pixel Art 2D)

Environment

Unity 2022.3.22f1, Built-in 2D Renderer, orthographic pixel game, Windows standalone, 2D Pixel Perfect + TMP UGUI. Fullscreen Mode: Exclusive Fullscreen (must use SetResolution for sharp pixel upscale).

Problem

  1. Editor Game View: All resolutions (640×480 / 1280×720 / 1920×1440) work perfectly, TMP stays top, no occlusion, UI scales correctly.
  2. Windows Build:
    • 640×480 / 1280×720 fullscreen/windowed: No issues.
    • F11 trigger Screen.SetResolution(1920,1440,true): TMP text occluded by scene sprites, Canvas Scaler fails to auto-scale UI.
  3. Side effect: Every SetResolution fully rebuilds Canvas; TMP prefab instance reference nulls out occasionally.

Setup

  • Ortho camera with fixed size + Pixel Perfect Camera (Upscale enabled, AA disabled)
  • Canvas: Originally Screen Space-Camera, Plane Distance forced to 0.2 via script, Unity overwrites value after resolution switch.
  • Canvas Scaler: Scale With Screen Size, ref 640×480, Match=0.5
  • TMP: Prefab spawned at runtime, tested DistanceFieldOverlay shader, ZWrite Off, max render queue, no improvement on occlusion.

Tried fixes (no effect on 1920×1440 occlusion)

  1. Switch Canvas to Screen Space-Overlay
  2. Lock Canvas Plane Distance in OnRectTransformDimensionsChange
  3. Re-instantiate TMP prefab after resolution change
  4. Lock camera ortho size
  5. Mark Canvas DontDestroyOnLoad
  6. Adjust Pixel Perfect Camera upscale parameters

Code snippet (F11 toggle)

void ToggleFullscreen()
{
    if (Screen.fullScreen)
        Screen.SetResolution(640, 480, false);
    else
        Screen.SetResolution(1920, 1440, true);
}

Questions

  1. Why only 1920×1440 in standalone build triggers Canvas Plane Distance drift & UI occlusion, Editor & smaller resolutions unaffected?
  2. Any way to run SetResolution without Canvas rebuild / Plane Distance modification?
  3. Why Canvas Scaler stops scaling UI only at 1920×1440 in build?
  4. Pixel art fullscreen plugins with sharp integer scaling that skip SetResolution entirely to avoid Canvas bugs?
unity-game-engine