void Update() { if (!isChangeActive) { return; } if (Input.GetKeyDown(KeyCode.Escape)) { SetKeyChangeState(false); return; } var pressedKey = GetPressedKey(); if (pressedKey != null) { keyAction.key = (KeyCode)pressedKey; buttonText.text = keyAction.key.ToString(); SetKeyChangeState(false); Keymap.Save(); } }