Plugin: never cache a zero baseline for world-space canvases
The in-game log showed 'World Canvas localScale (0,0,0) -> (0,0,0)'. Games hide world-space UI by zeroing its scale; if that zero got cached as the baseline, multiplying it would pin the canvas to zero permanently and the UI could never reappear. Now skips canvases that are currently zeroed - both when capturing the baseline and when applying - so hidden UI is left alone and picked up once the game shows it again. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -125,11 +125,20 @@ namespace BurglinGnomes.UltraWideFix
|
|||||||
if (canvas.renderMode == RenderMode.WorldSpace)
|
if (canvas.renderMode == RenderMode.WorldSpace)
|
||||||
{
|
{
|
||||||
if (Mathf.Approximately(_worldScale.Value, 1f)) continue;
|
if (Mathf.Approximately(_worldScale.Value, 1f)) continue;
|
||||||
|
|
||||||
|
var cur = cs.transform.localScale;
|
||||||
|
// Games hide world-space UI by zeroing its scale. Never cache a
|
||||||
|
// zero baseline: if we did, multiplying it would pin the canvas
|
||||||
|
// to zero forever and the UI could never reappear.
|
||||||
if (!_scaleBaseline.TryGetValue(id, out var base3))
|
if (!_scaleBaseline.TryGetValue(id, out var base3))
|
||||||
{
|
{
|
||||||
base3 = cs.transform.localScale;
|
if (cur.x <= 0.0001f) continue; // hidden right now; revisit later
|
||||||
|
base3 = cur;
|
||||||
_scaleBaseline[id] = base3;
|
_scaleBaseline[id] = base3;
|
||||||
}
|
}
|
||||||
|
// Respect the game hiding it: leave zeroed canvases alone.
|
||||||
|
if (cur.x <= 0.0001f) continue;
|
||||||
|
|
||||||
var want = base3 * _worldScale.Value;
|
var want = base3 * _worldScale.Value;
|
||||||
if (cs.transform.localScale != want)
|
if (cs.transform.localScale != want)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user