From c658282979a86ccbac9749b6133df0c6a1d06833 Mon Sep 17 00:00:00 2001 From: nexovec <30555041+nexovec@users.noreply.github.com> Date: Sun, 30 Jan 2022 13:23:10 +0100 Subject: [PATCH] fixed supposed bug --- Assets/Scripts/PlayerController.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 3606ec7..9a53f3d 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -176,10 +176,11 @@ public class PlayerController : MonoBehaviour } var distanceFromYAxis = new Vector2(rb.position.x, rb.position.y).magnitude; - if (distanceFromYAxis > this.maxDistanceFromCenterLine) + if (UiController.isInMenu == false && distanceFromYAxis > this.maxDistanceFromCenterLine) { Debug.Log("Player fell out of map."); rb.velocity = Vector3.zero; + UiController.isInMenu = true; Physics.gravity = -Vector3.up * 9.81f; UiController.SaveGame(); UnityEngine.SceneManagement.SceneManager.LoadScene(0);