diff --git a/tools/unity_uitune.cs b/tools/unity_uitune.cs index 2490623..eb7e7c7 100644 --- a/tools/unity_uitune.cs +++ b/tools/unity_uitune.cs @@ -10,9 +10,11 @@ // ---- 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 +// HUD_SCALE shrinks/grows the HUD *without* cramping the layout. +// <1 = smaller HUD + MORE logical room (use this to cure overlapping text) +// Implemented by raising referenceResolution.y, because CanvasScaler.scaleFactor +// is IGNORED in ScaleWithScreenSize mode (it only applies to ConstantPixelSize). +float HUD_SCALE = 1.0f; // try 0.95, 0.9, 0.85 bool LIST_ONLY = false; // true = report current state, change nothing // ---------------------------------------------------------------------------- @@ -27,10 +29,14 @@ foreach (var cs in UnityEngine.Object.FindObjectsOfType 0 && REF_H > 0) - cs.referenceResolution = new UnityEngine.Vector2(REF_W, REF_H); cs.matchWidthOrHeight = MATCH; - cs.scaleFactor = SCALE_MULT; + if (HUD_SCALE > 0f && System.Math.Abs(HUD_SCALE - 1f) > 0.0001f) + { + // effective scale = screenH / refH, so refH = designH / HUD_SCALE + var r = cs.referenceResolution; + cs.referenceResolution = new UnityEngine.Vector2(r.x, 1080f / HUD_SCALE); + log.AppendLine($" refResolution {r} -> {cs.referenceResolution}"); + } } // report the resulting logical canvas the UI is laid out in