using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class OpenSettingsOnESCPress : MonoBehaviour { public GameObject SettingsMainPanel; public GameObject SettingsPanel; public GameObject SoundsPanel; public GameObject ControlsPanel; public GameObject LanguagePanel; public KeyCode keyToSettings; private void Start() { if (!PlayerPrefs.HasKey("Settings")) { Debug.Log("NIE MA KEY!"); keyToSettings = KeyCode.Escape; } else { Debug.Log("MA KEY!"); keyToSettings = (KeyCode) System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Settings")); } } void Update() { if (PlayerPrefs.HasKey("Settings")) { keyToSettings = (KeyCode) System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Settings")); } if (Input.GetKeyUp(keyToSettings)) { Debug.Log("WYKRYWA KLAWISZ!"); if ((SettingsMainPanel.active == false) && (SettingsPanel.active == false) && (SoundsPanel.active == false) && (ControlsPanel.active == false) && (LanguagePanel.active == false)) { SettingsMainPanel.SetActive(true); } else { SettingsMainPanel.SetActive(false); SettingsPanel.SetActive(false); SoundsPanel.SetActive(false); ControlsPanel.SetActive(false); LanguagePanel.SetActive(false); } } } }