private void Update() { var shifted = Input.GetKey(KeyCode.LeftShift); for (var keyCode = KeyCode.A; keyCode <= KeyCode.Z; keyCode++) { if (Input.GetKeyDown(keyCode)) { var character = keyCode.ToString(); keyboard.AddCharacter(shifted ? character.ToUpper() : character.ToLower()); } } if (Input.GetKeyDown(KeyCode.Return)) { HandleSubmit(keyboard.text); } if (Input.GetKeyDown(KeyCode.Escape)) { keyboard.SetText(""); } if (Input.GetKeyDown(KeyCode.Backspace)) { keyboard.Backspace(); } if (Input.GetKeyDown(KeyCode.Space)) { keyboard.AddCharacter(" "); } }
// Update is called once per frame void Update() { foreach (char c in Input.inputString) { if (c >= 'a' && c <= 'z') { keyboard.AddCharacter(c.ToString()); } } }