From 0a8fa5a1aae634f8eb2149ed4edd5e5796b15f23 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Sat, 2 Dec 2023 20:20:13 -0500 Subject: [PATCH] more safety here --- Assets/Scripts/UI/PauseMenu.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/UI/PauseMenu.cs b/Assets/Scripts/UI/PauseMenu.cs index 777edcf89..cadd5408d 100644 --- a/Assets/Scripts/UI/PauseMenu.cs +++ b/Assets/Scripts/UI/PauseMenu.cs @@ -57,7 +57,7 @@ namespace HeavenStudio.Common isPaused = true; canPick = false; optionSelected = 0; - ChooseOption((Options)optionSelected, false); + ChooseCurrentOption(); } void UnPause(bool instant = false) @@ -130,10 +130,9 @@ namespace HeavenStudio.Common { foreach (Transform t in optionHolder.transform) { - if (t.GetComponent().OverlapPoint(PlayerInput.GetInputController(1).GetPointer())) + if (t.TryGetComponent(out Collider2D c) && c.OverlapPoint(PlayerInput.GetInputController(1).GetPointer())) { int idx = t.GetSiblingIndex(); - ChooseOption((Options)idx, idx != optionSelected); optionSelected = idx; break; }