void Update ()
{
// Only the first UI layer should be processing events
if (!Application.isPlaying || !handlesEvents) return;
current = this;
// Update mouse input
if (useMouse || (useTouch && mIsEditor)) ProcessMouse();
// Process touch input
if (useTouch) ProcessTouches();
// Custom input processing
if (onCustomInput != null) onCustomInput();
// Clear the selection on the cancel key, but only if mouse input is allowed
if (useMouse && mSel != null && ((cancelKey0 != KeyCode.None && Input.GetKeyDown(cancelKey0)) ||
(cancelKey1 != KeyCode.None && Input.GetKeyDown(cancelKey1)))) selectedObject = null;
// Forward the input to the selected object
if (mSel != null)
{
string input = Input.inputString;
// Adding support for some macs only having the "Delete" key instead of "Backspace"
if (useKeyboard && Input.GetKeyDown(KeyCode.Delete)) input += "\b";
if (input.Length > 0)
{
if (!stickyTooltip && mTooltip != null) ShowTooltip(false);
Notify(mSel, "OnInput", input);
}
}
else inputHasFocus = false;
// Update the keyboard and joystick events
if (mSel != null) ProcessOthers();
// If it's time to show a tooltip, inform the object we're hovering over
if (useMouse && mHover != null)
{
float scroll = Input.GetAxis(scrollAxisName);
if (scroll != 0f) Notify(mHover, "OnScroll", scroll);
if (showTooltips && mTooltipTime != 0f && (mTooltipTime < Time.realtimeSinceStartup ||
Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)))
{
mTooltip = mHover;
ShowTooltip(true);
}
}
current = null;
}