From 3525c79dba5daa27cc9e6f8e378aeaa47e722b32 Mon Sep 17 00:00:00 2001 From: ckoch Date: Tue, 21 Jul 2026 15:51:38 -0400 Subject: [PATCH] Burglin' Gnomes: camera confirmed correct, add live UI tuner orthographicSize is constant at 5.0 across 1920x1080 and 5120x1440 (visible height 10.0, width 17.8 -> 35.6). The camera is already textbook Hor+ and needs no patch - the entire ultrawide problem is HUD scaling. CanvasScaler match=0.453 gave scaleFactor 1.948 (ballooned HUD); match=1 gives 1.333 with logical height exactly 1080 (the design height). Adds a live tuner with independent match / scaleFactor / referenceResolution knobs to chase the remaining text overlap. Co-Authored-By: Claude Opus 4.8 --- tools/unity_uitune.cs | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tools/unity_uitune.cs diff --git a/tools/unity_uitune.cs b/tools/unity_uitune.cs new file mode 100644 index 0000000..2490623 --- /dev/null +++ b/tools/unity_uitune.cs @@ -0,0 +1,50 @@ +// LIVE UI TUNER — paste into UnityExplorer's C# Console. Edit the knobs, Run, look, +// repeat. Nothing persists; relaunching reverts everything. +// +// IMPORTANT: run this IN-GAME (not the main menu). Different scenes have different +// canvases, and the overlapping text is in the gameplay HUD. +// +// scaleFactor = (screenW/refW)^(1-match) * (screenH/refH)^match +// match=1 scales by HEIGHT (logical height stays 1080 = the design height). +// Lowering match shrinks logical height below 1080 and CRAMPS things vertically. + +// ---- KNOBS ----------------------------------------------------------------- +float MATCH = 1.0f; // 0 = scale by width, 1 = scale by height +float SCALE_MULT = 1.0f; // extra multiplier on top (0.9 = 10% smaller HUD) +float REF_W = 0f; // 0 = leave reference resolution alone +float REF_H = 0f; // e.g. set 3840/1080 to design against ultrawide +bool LIST_ONLY = false; // true = report current state, change nothing +// ---------------------------------------------------------------------------- + +var log = new System.Text.StringBuilder(); +log.AppendLine($"SCREEN {UnityEngine.Screen.width}x{UnityEngine.Screen.height} " + + $"aspect={(float)UnityEngine.Screen.width / UnityEngine.Screen.height:F4}"); + +foreach (var cs in UnityEngine.Object.FindObjectsOfType()) +{ + log.AppendLine($"BEFORE {cs.name}: mode={cs.uiScaleMode} ref={cs.referenceResolution} " + + $"match={cs.matchWidthOrHeight} scaleFactor={cs.scaleFactor}"); + + if (!LIST_ONLY) + { + if (REF_W > 0 && REF_H > 0) + cs.referenceResolution = new UnityEngine.Vector2(REF_W, REF_H); + cs.matchWidthOrHeight = MATCH; + cs.scaleFactor = SCALE_MULT; + } + + // report the resulting logical canvas the UI is laid out in + var cv = cs.GetComponent(); + float sf = cv ? cv.scaleFactor : 0f; + if (sf > 0) + log.AppendLine($"AFTER {cs.name}: effectiveScale={sf:F4} " + + $"logicalCanvas={UnityEngine.Screen.width / sf:F0}x{UnityEngine.Screen.height / sf:F0}"); +} + +// Every canvas in the scene — the overlapping text may live on one we haven't touched +foreach (var cv in UnityEngine.Object.FindObjectsOfType()) + log.AppendLine($"CANVAS {cv.name} mode={cv.renderMode} scale={cv.scaleFactor:F4} " + + $"hasScaler={(cv.GetComponent() != null)} " + + $"sortOrder={cv.sortingOrder}"); + +UnityExplorer.ExplorerCore.Log(log.ToString());