diff --git a/Assets/Scripts/Debug/ManafallDisableMirrorImgui.cs b/Assets/Scripts/Debug/ManafallDisableMirrorImgui.cs index ef2c2ddf4..9e4df0a66 100644 --- a/Assets/Scripts/Debug/ManafallDisableMirrorImgui.cs +++ b/Assets/Scripts/Debug/ManafallDisableMirrorImgui.cs @@ -4,12 +4,16 @@ using UnityEngine; /// /// Disables Mirror IMGUI HUDs that allocate tens of KB every frame via OnGUI. /// CLERK: also re-assert after a short delay — NetworkManager can re-enable showGUI on play. +/// Clears sticky F3/F4 debug overlay prefs once so player/probe builds start without screen clutter. /// public static class ManafallDisableMirrorImgui { + private const string DebugOverlaysHiddenPrefsKey = "Manafall.DebugOverlaysHidden_v1"; + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)] private static void DisableHeavyImgui() { + ClearStickyDebugOverlayPrefsOnce(); KillMirrorImgui(); var go = new GameObject("ClerkMirrorHudKiller"); Object.DontDestroyOnLoad(go); @@ -17,6 +21,23 @@ public static class ManafallDisableMirrorImgui go.AddComponent(); } + /// + /// One-shot for installed players: turn off saved F3/F4 visibility that agents left on. + /// Does not run in the Editor (F3 still defaults on there). + /// + public static void ClearStickyDebugOverlayPrefsOnce() + { + if (Application.isEditor) + return; + if (PlayerPrefs.GetInt(DebugOverlaysHiddenPrefsKey, 0) != 0) + return; + + PlayerPrefs.SetInt("Manafall.ViewCostDebug", 0); + PlayerPrefs.SetInt("Manafall.MemorySpikeDebug", 0); + PlayerPrefs.SetInt(DebugOverlaysHiddenPrefsKey, 1); + PlayerPrefs.Save(); + } + public static void KillMirrorImgui() { NetworkManagerHUD[] huds = Object.FindObjectsByType( diff --git a/Assets/Scripts/Rendering/ManafallMemorySpikeDebug.cs b/Assets/Scripts/Rendering/ManafallMemorySpikeDebug.cs index 562d318e4..b7c398c12 100644 --- a/Assets/Scripts/Rendering/ManafallMemorySpikeDebug.cs +++ b/Assets/Scripts/Rendering/ManafallMemorySpikeDebug.cs @@ -332,8 +332,17 @@ public sealed class ManafallMemorySpikeDebug : MonoBehaviour private void Awake() { - // Default on in player builds too — this is the hitch board now. - visible = PlayerPrefs.GetInt(PrefsKey, 1) != 0; + // Default OFF — the hitch board was sticky-on in player/probe builds and filled the screen. + // F7 still toggles it. One-shot clear so older installs that saved PrefsKey=1 start clean. + const string hideOnceKey = "Manafall.HideWalkHitchOverlay_v1"; + if (!Application.isEditor && PlayerPrefs.GetInt(hideOnceKey, 0) == 0) + { + PlayerPrefs.SetInt(PrefsKey, 0); + PlayerPrefs.SetInt(hideOnceKey, 1); + PlayerPrefs.Save(); + } + + visible = PlayerPrefs.GetInt(PrefsKey, 0) != 0; BuildLabel(); ApplyVisible(); } @@ -356,8 +365,8 @@ public sealed class ManafallMemorySpikeDebug : MonoBehaviour PlayerPrefs.SetInt(PrefsKey, visible ? 1 : 0); ApplyVisible(); UnityEngine.Debug.Log(visible - ? "[WalkHitch] Overlay on (F4). Walk — top rows are ms on hitch frames." - : "[WalkHitch] Overlay off (F4)."); + ? "[WalkHitch] Overlay on (F7). Walk — top rows are ms on hitch frames." + : "[WalkHitch] Overlay off (F7)."); } if (!visible || label == null) @@ -456,7 +465,7 @@ public sealed class ManafallMemorySpikeDebug : MonoBehaviour ExpireWindows(Time.unscaledTime); builder.Length = 0; - builder.Append("WALK HITCHES (F4 hide)\n"); + builder.Append("WALK HITCHES (F7 hide)\n"); builder.AppendFormat( "Frame {0:0.0} ms smooth {1:0.0} ms FPS {2:0} hitch≥{3:0} ms\n", frameMs, @@ -541,7 +550,7 @@ public sealed class ManafallMemorySpikeDebug : MonoBehaviour int n = FillSortedIndicesByWindowMs(); if (n == 0) { - builder.Append(" (no probes yet — keep walking with F4 on)\n"); + builder.Append(" (no probes yet — keep walking with F7 on)\n"); } else { @@ -926,7 +935,7 @@ public sealed class ManafallMemorySpikeDebug : MonoBehaviour private static bool WasTogglePressed() { Keyboard kb = Keyboard.current; - return kb != null && kb.f4Key.wasPressedThisFrame; + return kb != null && kb.f7Key.wasPressedThisFrame; } private static string FmtMb(long bytes) diff --git a/Assets/Scripts/Rendering/ManafallViewCostDebug.cs b/Assets/Scripts/Rendering/ManafallViewCostDebug.cs index 03597f6c2..35ad25ae8 100644 --- a/Assets/Scripts/Rendering/ManafallViewCostDebug.cs +++ b/Assets/Scripts/Rendering/ManafallViewCostDebug.cs @@ -116,6 +116,16 @@ public sealed class ManafallViewCostDebug : MonoBehaviour private void Awake() { + // Player/probe builds: clear sticky F3 prefs left on from agent smoke runs. + // Editor still defaults on; F3 toggles everywhere. + const string hideOnceKey = "Manafall.HideViewCostOverlay_v1"; + if (!Application.isEditor && PlayerPrefs.GetInt(hideOnceKey, 0) == 0) + { + PlayerPrefs.SetInt(PrefsKey, 0); + PlayerPrefs.SetInt(hideOnceKey, 1); + PlayerPrefs.Save(); + } + visible = PlayerPrefs.GetInt(PrefsKey, Application.isEditor ? 1 : 0) != 0; BuildLabel(); ApplyVisible();