jyhlearning

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

输入和控制

按键检测

Input.GetKeyDown(KeyCode.W);//检测按键是否按下(是指的按下的一瞬间状态),这里是是否按下w
Input.GetKeyUp(KeyCode.W);//检测按键是否抬起(是指的抬起的一瞬间状态),这里是检测的w
Input.GetKey(KeyCode.W);//检测按键是否处于按下状态(按下的持续状态)
Input.anyKeyDown//检测任意按键是否按下
Input.anyKey//检测任意按键是否处于按下状态
Input.GetMouseButtonDown(0);//鼠标左键
Input.GetMouseButtonDown(1);//鼠标右键
Input.GetMouseButtonDown(2);//鼠标中键
Input.GetMouseButtonUp(0);
Input.GetMouseButtonUp(1);
Input.GetMouseButtonUp(2);
Input.GetMouseButton(0);
Input.GetMouseButton(1);
Input.GetMouseButton(2);

Input.GetButtonUp("test");//自定义按键test,在edit/project setting/input manager可以自定义
Input.GetButtonDown("test");
Input.GetButton("test");

Input.GetAxis("test");//获得在自定义按键上的一个轴上的按键的值,默认为0,在轴上的两个键一个是1,另一个是-1,
Input.GetAxis("Mouse X");//得到鼠标在屏幕上移动的值,1到-1之间,动的话才有
Input.GetAxis("Mouse Y");

posted on   jyhlearning  阅读(39)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 一文读懂知识蒸馏
· 终于写完轮子一部分:tcp代理 了,记录一下
点击右上角即可分享
微信分享提示