diff --git a/MrBigsock/Assets/Code/PlayerController.cs b/MrBigsock/Assets/Code/PlayerController.cs index f27bd483930b9c3e48c2e1b28c775eeb65939953..9c0afbd38ed66b495c151d2edb71ea5565ac1797 100644 --- a/MrBigsock/Assets/Code/PlayerController.cs +++ b/MrBigsock/Assets/Code/PlayerController.cs @@ -218,7 +218,8 @@ namespace BigSock { // Code for opening the menu. if (Input.GetKeyDown(KeyCode.I)) { GameObject canvas = GameObject.Find("Canvas"); - if(canvas != null) { + GameObject oldPlayerMenu = GameObject.Find("PlayerMenu(Clone)"); + if (canvas != null && oldPlayerMenu == null) { var playerMenu = PrefabService.SINGLETON.Instance("UI/PlayerMenu", canvas.transform); var invMen = playerMenu.transform.GetChild(1).transform.GetChild(0).GetComponent<InventoryPanel>(); var statMen = playerMenu.transform.GetChild(1).transform.GetChild(1).GetComponent<StatPanel>(); diff --git a/MrBigsock/Assets/Code/UI/PlayerMenu.cs b/MrBigsock/Assets/Code/UI/PlayerMenu.cs index 67e69c146694115526d486d91a9c3c96bbdd234c..34df35c177fe137a4d737c4095c03decc2666a86 100644 --- a/MrBigsock/Assets/Code/UI/PlayerMenu.cs +++ b/MrBigsock/Assets/Code/UI/PlayerMenu.cs @@ -6,9 +6,21 @@ namespace BigSock.UI { public class PlayerMenu : MonoBehaviour { + float originalTime; + public void Start() + { + originalTime = Time.timeScale; + Time.timeScale = 0; + } public void ExitMenu() { Destroy(gameObject); + + } + + public void OnDestroy() + { + Time.timeScale = originalTime; } } }