UnityGUI 事件。
事件与用户输入(按键、鼠标操作)相对应,或者是 UnityGUI 布局或渲染事件。
对于每个事件,在这些脚本中均调用 OnGUI;因此每帧可能多次调用 OnGUI。
Event.current 对应于 OnGUI 调用内的“当前”事件。
另请参阅:GUI 脚本指南、EventType。
current | 将被立即处理的当前事件。 |
alt | Alt/Option 键是否被按住?(只读) |
button | 已按下哪个鼠标键。 |
capsLock | 是否打开了 Caps Lock?(只读) |
character | 键入的字符。 |
clickCount | 已收到了多少次连续鼠标点击。 |
command | Command/Windows 键是否被按住?(只读) |
commandName | ExecuteCommand 或 ValidateCommand 事件的名称。 |
control | Control 键是否被按住?(只读) |
delta | 与上次事件相比该鼠标的相对移动。 |
displayIndex | 该事件所属的显示器的索引。 |
functionKey | 当前按键是否是功能键?(只读) |
isKey | 该事件是否是键盘事件?(只读) |
isMouse | 该事件是否是鼠标事件?(只读) |
keyCode | 键盘事件的原始键代码。 |
modifiers | 哪些修改键被按住。 |
mousePosition | 鼠标位置。 |
numeric | 当前按键是否在数字键盘上?(只读) |
pointerType | 创建事件的指针的类型(例如鼠标、触控屏幕、笔)。 |
pressure | 施加了多大的触笔压力。 |
shift | Shift 键是否被按住?(只读) |
type | 事件的类型。 |
GetTypeForControl | 获取给定控件 ID 的已筛选事件类型。 |
Use | 使用该事件。 |
GetEventCount | 返回存储在事件队列中的事件的当前数量。 |
KeyboardEvent | 创建键盘事件。 |
PopEvent | 从事件系统获取排队的下一个 [Event]。 |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.