TMP UI occluded after SetResolution(1920,1440,true) in Windows build; 640×480 / 1280×720 work fine, Editor all resolutions normal
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
- Editor Game View: All resolutions (640×480 / 1280×720 / 1920×1440) work perfectly, TMP stays top, no occlusion, UI scales correctly.
- 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.
- 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)
- Switch Canvas to Screen Space-Overlay
- Lock Canvas Plane Distance in OnRectTransformDimensionsChange
- Re-instantiate TMP prefab after resolution change
- Lock camera ortho size
- Mark Canvas DontDestroyOnLoad
- 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
- Why only 1920×1440 in standalone build triggers Canvas Plane Distance drift & UI occlusion, Editor & smaller resolutions unaffected?
- Any way to run SetResolution without Canvas rebuild / Plane Distance modification?
- Why Canvas Scaler stops scaling UI only at 1920×1440 in build?
- Pixel art fullscreen plugins with sharp integer scaling that skip SetResolution entirely to avoid Canvas bugs?