Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class NewBehaviourScript : MonoBehaviour {
- public Text textTesterLinux;
- void KK()
- {
- if (textTesterLinux == null) { return; }
- var pressedKeyCode = KeyCode.None;
- if (Input.anyKeyDown)
- {
- pressedKeyCode = FetchKey();
- if (pressedKeyCode != KeyCode.None)
- {
- textTesterLinux.text = "keycode " + "{" + pressedKeyCode + "}" + " keycodeCODE " + "{" + (int)pressedKeyCode + "}";
- }
- }
- else
- if (Input.anyKey)
- {
- pressedKeyCode = FetchKey();
- if (pressedKeyCode != KeyCode.None)
- {
- textTesterLinux.text = "999 keycode " + "{" + pressedKeyCode + "}" + " keycodeCODE " + "{" + (int)pressedKeyCode + "}";
- }
- }
- }
- KeyCode FetchKey()
- {
- foreach (KeyCode kk in Enum.GetValues(typeof(KeyCode)))
- {
- if (Input.GetKeyDown(kk))
- {
- return kk;
- }
- }
- return KeyCode.None;
- }
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- KK();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement