一.键盘的输入

•GetKey,GetKeyDown,GetKeyUp三个方法分别获取用户键盘按键的输入

1. GetKey:用户长按按键有效;

 bool down = Input.GetKeyDown(KeyCode.Space);  

2. GetKeyDown:用户按下按键时有效;

 bool held = Input.GetKey(KeyCode.Space);

3.GetKeyUp:用户抬起按键时有效;

bool up = Input.GetKeyUp(KeyCode.Space);

  

• anyKey,anyKeyDown

anyKey用于监听用户的任意按键输入或鼠标点击,事件触发后返回true。anyKeyDown:当任意按键松开时返回true。

示例

if (Input.anyKey)

{

}

  

二.鼠标的输入

•GetMouseButton

1. GetMouseButton 对应的键处于按下状态时返回true

2. GetMouseButtonDown 对应的键被按下时返回true

3. GetMouseButtonUp 对应的键弹起时返回true

示例:

  if (Input.GetMouseButton(0))

       {

          //"鼠标左键按下"

       }  

       else if(Input.GetMouseButton(1)) 

      {

          //"鼠标右键按下"

       } 

      else if(Input.GetMouseButton(2))

     {

         // "鼠标中键按下"

     }

  

最新文章

  1. 个人总结深入.NET平台和C#编程
  2. Android Studio中获取SHA1或MD5的方法
  3. Core 开发-Logging 使用NLog
  4. MySQL连表操作之一对多
  5. 简单实用的Log4net帮助类
  6. PNote桌面贴小工具 - 项目管理系列文章
  7. System.currentTimeMillis()计算方式与时间的单位转换
  8. Android入门:发送HTTP的GET和POST请求
  9. SQLLite 简介
  10. wamp虚拟机配置
  11. 如何解决JavaWeb乱码问题
  12. 微信小程序数据请求方法wx.request小测试
  13. python模块 ---logging模块
  14. npm 如何安装npm包
  15. Spring Boot 整合 docker
  16. 单点登录SSO:可一键运行的完整代码
  17. 14.statefulset服务
  18. SqlServer查找字段中带空值的项
  19. mysql添加Federated引擎问题
  20. os 模块 和 os模块下的path模块

热门文章

  1. shell编程之if语句
  2. hdu4107Gangster 线段树
  3. 你真的理解 if __name__ == '__main__' 的作用么?
  4. Centos 8 安装 Consul-Template
  5. 加密解密 Python
  6. javascript创建函数的方法
  7. Infrared-Visible Cross-Modal Person Re-Identification with an X Modality (AAAI 2020)
  8. 【webpack 系列】进阶篇
  9. 【开源项目系列】如何基于 Spring Cache 实现多级缓存(同时整合本地缓存 Ehcache 和分布式缓存 Redis)
  10. 2288: 【基础】小X转进制