From 9c7727a48e485c63db450028a54b3981eb15ee77 Mon Sep 17 00:00:00 2001 From: lcscout Date: Sun, 1 May 2022 19:26:55 -0300 Subject: [PATCH] fix(UIManager): when on last level dont load any other --- Assets/Scripts/UI/UIManager.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/UI/UIManager.cs b/Assets/Scripts/UI/UIManager.cs index f787ad5..0a95105 100644 --- a/Assets/Scripts/UI/UIManager.cs +++ b/Assets/Scripts/UI/UIManager.cs @@ -104,8 +104,11 @@ public void CloseAnyMenu() { #region State-Changing Methods public void Continue() { - if (SceneManager.GetActiveScene().buildIndex + 1 >= SceneManager.sceneCountInBuildSettings) + bool isLastLevel = SceneManager.GetActiveScene().buildIndex + 1 >= SceneManager.sceneCountInBuildSettings; + if (isLastLevel) { GameManager.Instance.LoadLevel(0); + return; + } GameManager.Instance.LoadLevel(SceneManager.GetActiveScene().buildIndex + 1); }