Files
UltraWidePatches/tools/unity_diag.cs
T
ckochandClaude Opus 4.8 8bbc1cfac8 Correct Burglin' Gnomes diagnosis: camera is ORTHOGRAPHIC
fieldOfView is meaningless here (reads 60 at every resolution because nothing
uses it). The governing value is orthographicSize. Diagnostic now reports
orthoSize plus computed visible width/height, and checks Cinemachine lens
ortho size too.

Also confirmed the HUD cause: CanvasScaler match=0.453 (width-biased) with a
1920x1080 reference, which balloons the HUD at 5120px wide. Added a live
fix-test script to try match=1 and an orthoSize override in-game.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 15:31:05 -04:00

60 lines
3.1 KiB
C#

// UnityExplorer C# console diagnostic — paste into the C# Console tab, hit Run.
// Run once at ultrawide and once at 16:9, then compare.
//
// NOTE: Burglin' Gnomes uses an ORTHOGRAPHIC camera, so fieldOfView is meaningless.
// The governing value is orthographicSize (half the visible world HEIGHT):
// visible height = 2 * orthographicSize
// visible width = visible height * aspect
// If orthographicSize is CONSTANT across resolutions -> already Hor+ (correct).
// If it SHRINKS at wider aspect -> the game holds world-width constant (Vert- lock).
var sb = new System.Text.StringBuilder();
sb.AppendLine($"SCREEN {UnityEngine.Screen.width}x{UnityEngine.Screen.height} " +
$"aspect={(float)UnityEngine.Screen.width / UnityEngine.Screen.height:F4} " +
$"full={UnityEngine.Screen.fullScreenMode}");
foreach (var c in UnityEngine.Object.FindObjectsOfType<UnityEngine.Camera>())
{
if (c.orthographic)
sb.AppendLine($"CAM {c.name} ORTHO size={c.orthographicSize:F4} aspect={c.aspect:F4} " +
$"=> visibleW={2f * c.orthographicSize * c.aspect:F3} visibleH={2f * c.orthographicSize:F3} " +
$"depth={c.depth} enabled={c.enabled}");
else
sb.AppendLine($"CAM {c.name} PERSP fov={c.fieldOfView:F2} aspect={c.aspect:F4} " +
$"phys={c.usePhysicalProperties} gate={c.gateFit} depth={c.depth} enabled={c.enabled}");
}
// --- Cinemachine (any version) via reflection: may drive ortho size each frame ---
var bf = System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Instance;
foreach (var mb in UnityEngine.Object.FindObjectsOfType<UnityEngine.MonoBehaviour>())
{
var t = mb.GetType();
if (t.FullName == null || t.FullName.IndexOf("Cinemachine", System.StringComparison.OrdinalIgnoreCase) < 0)
continue;
object lens = null;
foreach (var name in new[] { "Lens", "m_Lens" })
{
var p = t.GetProperty(name, bf); if (p != null) { lens = p.GetValue(mb); break; }
var f = t.GetField(name, bf); if (f != null) { lens = f.GetValue(mb); break; }
}
if (lens != null)
{
var lt = lens.GetType();
object osize = null, fov = null;
foreach (var n in new[] { "OrthographicSize", "m_OrthographicSize" })
{ var f = lt.GetField(n, bf); if (f != null) { osize = f.GetValue(lens); break; } }
foreach (var n in new[] { "FieldOfView", "m_FieldOfView" })
{ var f = lt.GetField(n, bf); if (f != null) { fov = f.GetValue(lens); break; } }
sb.AppendLine($"CM {t.Name} '{mb.name}' lensOrthoSize={osize} lensFOV={fov} enabled={mb.enabled}");
}
else sb.AppendLine($"CM {t.Name} '{mb.name}' (no lens) enabled={mb.enabled}");
}
// --- uGUI canvas scalers: match=0 scales by WIDTH (bad at ultrawide), 1 = by HEIGHT ---
foreach (var cs in UnityEngine.Object.FindObjectsOfType<UnityEngine.UI.CanvasScaler>())
sb.AppendLine($"UI {cs.name} mode={cs.uiScaleMode} ref={cs.referenceResolution} " +
$"match={cs.matchWidthOrHeight} screenMatch={cs.screenMatchMode} scaleFactor={cs.scaleFactor}");
UnityExplorer.ExplorerCore.Log(sb.ToString());