private void Update() { if (item == null) { return; } if (!Input.anyKeyDown) { return; } foreach (KeyCode code in Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyDown(code)) { if (code != KeyCode.Escape) { item.SetKeyCode(code); } item = null; panel.gameObject.SetActive(false); break; } } }
private void Start() { var keyList = defineData.GetKeyNameList(); foreach (var key in keyList) { var instance = Instantiate(prefab, parent.content); instance.SetKey(key); instance.OnChanging += () => { item = instance; panel.gameObject.SetActive(true); }; } }