UnityGUI のインプットと処理するイベントの種類
Use this to tell which type of event has taken place in the GUI. Types of Events include mouse clicking, mouse dragging, button pressing, the mouse entering or exiting the window, and the scroll wheel as well as others mentioned below.
関連項目: Event.type, Event, GUI Scripting Guide.
//Attach this script to a GameObject //This script is a basic overview of some of the Event Types available. It outputs messages depending on the current Event Type.
using UnityEngine;
public class Example : MonoBehaviour { void OnGUI() { Event m_Event = Event.current;
if (m_Event.type == EventType.MouseDown) { Debug.Log("Mouse Down."); }
if (m_Event.type == EventType.MouseDrag) { Debug.Log("Mouse Dragged."); }
if (m_Event.type == EventType.MouseUp) { Debug.Log("Mouse Up."); } } }
MouseDown | マウスボタンが押されました。 |
MouseUp | (押していた) マウスボタンを離しました。 |
MouseMove | Mouse was moved (Editor views only). |
MouseDrag | マウスでドラッグしました。 |
KeyDown | キーボードのキーが押されました。 |
KeyUp | (押されていた) キーボードのキーを離しました。 |
ScrollWheel | マウスホイールを動かしました。 |
Repaint | イベントが再度描画されるときのイベント。毎フレーム呼び出されます。 |
Layout | レイアウトイベント |
DragUpdated | エディターのみ: ドラッグ&ドロップで操作が更新されたときのイベント |
DragPerform | エディターのみ: ドラッグ&ドロップの操作を実行したときのイベント |
DragExited | エディターのみ: ドラッグ&ドロップで操作が終了したときのイベント |
Ignore | Event を無効化 |
Used | すでに処理されたイベント |
ValidateCommand | コピー&ペーストなどの特別なコマンドを検証 |
ExecuteCommand | コピー&ペーストなどの特別なコマンドを実行 |
ContextClick | 右クリック (Mac 上では control +クリック) しました。 |
MouseEnterWindow | Mouse entered a window (Editor views only). |
MouseLeaveWindow | Mouse left a window (Editor views only). |
TouchDown | Direct manipulation device (finger, pen) touched the screen. |
TouchUp | Direct manipulation device (finger, pen) left the screen. |
TouchMove | Direct manipulation device (finger, pen) moved on the screen (drag). |
TouchEnter | Direct manipulation device (finger, pen) moving into the window (drag). |
TouchLeave | Direct manipulation device (finger, pen) moved out of the window (drag). |
TouchStationary | Direct manipulation device (finger, pen) stationary event (long touch down). |
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.