一、Unity的基本输入事件(最常用):
鼠标点击:
Input.GetMouseButtonDown(0) //鼠标左键按下
Input.GetMouseButtonDown(1) //鼠标右键按下
Input.GetMouseButtonUp(0) //鼠标左键抬起
Input.GetMouseButtonUp(1) //鼠标右键抬起键盘事件:
Input.GetKeyDown(KeyCode.键值) //键盘按下
Input.GetKeyUp(KeyCode.键值) //键盘抬起常用的键值:
KeyCode.大写字母A-Z //字母键
KeyCode.UpArrow
KeyCode.DownArrow
KeyCode.LeftArrow
KeyCode.RightArrow
KeyCode.Return //回车
KeyCode.Escape //Esc返回
KeyCode.Space //空格
KeyCode.LeftControl
KeyCode.RightControl
KeyCode.LeftShift
KeyCode.RightShift
KeyCode.Tab
KeyCode.Delete
KeyCode.Backspace
二、获取键盘或者各电视遥控器键值用于输入事件适配
using UnityEngine;
using System.Collections;