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