From 06bbc1e87f12e25a53dabb9deae3b5001c0d2ce8 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 26 Aug 2025 20:42:54 -0400 Subject: [PATCH] feat: no longer need to manually create an overlay- attempting to change a value adds it. no longer Vector3 in creator --- Assets/Scripts/Core/Tools/DebugOverlayDrawer.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Core/Tools/DebugOverlayDrawer.cs b/Assets/Scripts/Core/Tools/DebugOverlayDrawer.cs index fa57e2f..971463e 100644 --- a/Assets/Scripts/Core/Tools/DebugOverlayDrawer.cs +++ b/Assets/Scripts/Core/Tools/DebugOverlayDrawer.cs @@ -63,7 +63,7 @@ namespace Reset.Core.Tools{ public static DebugOverlayDrawer Instance; - public static void AddOnOverlay(string pageName, string sourceName, Vector3 position){ + public static void AddOnOverlay(string pageName, string sourceName){ // Make sure the page exists. If it does, use it. If not, create it GameObject thisPageObject = null; bool alreadyExisted = false; @@ -134,7 +134,18 @@ namespace Reset.Core.Tools{ // Publicly accessible method to change the value public static void ChangeValue(string pageName, string sourceName, string newValue){ - Instance.values[$"{pageName}/{sourceName}"].text = newValue; + try { + Instance.values[$"{pageName}/{sourceName}"].text = newValue; + } catch (Exception e) { + try { + AddOnOverlay(pageName, sourceName); + Instance.values[$"{pageName}/{sourceName}"].text = newValue; + throw; + } catch (Exception exception) { + Debug.LogError($"Failed to both update an existing or create a new debug overlay: {exception.Message}" ); + throw; + } + } } // Publicly accessible method to change the color