这里我们首先就简易的制作一个非常简单的3D按钮![ 图中就一个cube 加个3DText,然后我们就编写代码 [RequireComponent(typeof(CompoundButton))]//特效用语 public class CompoundButtonSounds : ProfileButtonBase<ButtonSoundProfile>//泛型类需求T必须符合 where T 的要求 { //这里说明下 定义的ButtonSoundProfile就一个
1.调用GetAsyncKeyState()获取指定按键的状态,GetActiveKey()检索指定范围内的按键状态 2.调用keybd_event()可合成一次击键事件,通常两次击键事件间需要设定时间间隔 3.调用MapVirtualKey()获取指定按键的硬件扫描码,传入keybd_event()第二个参数就可以对DirectInput有效. Public Class ImitateKeyClass Private Declare Sub keybd_event Lib "user32&qu
获取当前键盘按键,代码如下: using UnityEngine; using System.Collections; public class GetCurrentKey : MonoBehaviour { KeyCode currentKey; void Start () { currentKey = KeyCode.Space; } void OnGUI() { if (Input.anyKeyDown) { Event e = Event.current; if (e.isKey) {