Is the pointer with the given ID over an EventSystem object?
static public int IsPointerOverGameObject(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.EventSystems.BaseInputModule self = (UnityEngine.EventSystems.BaseInputModule)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); var ret = self.IsPointerOverGameObject(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
public bool IsPointerOverGameObject(int pointerId) { if (m_CurrentInputModule == null) { return(false); } return(m_CurrentInputModule.IsPointerOverGameObject(pointerId)); }
static public int IsPointerOverGameObject(IntPtr l) { try { UnityEngine.EventSystems.BaseInputModule self = (UnityEngine.EventSystems.BaseInputModule)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); var ret = self.IsPointerOverGameObject(a1); pushValue(l, ret); return(1); } catch (Exception e) { return(error(l, e)); } }
static int IsPointerOverGameObject(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.EventSystems.BaseInputModule obj = (UnityEngine.EventSystems.BaseInputModule)ToLua.CheckObject <UnityEngine.EventSystems.BaseInputModule>(L, 1); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); bool o = obj.IsPointerOverGameObject(arg0); LuaDLL.lua_pushboolean(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// Is the pointer with the given ID over an EventSystem object? /// </summary> /// <remarks> /// If you use IsPointerOverGameObject() without a parameter, it points to the "left mouse button" (pointerId = -1); therefore when you use IsPointerOverGameObject for touch, you should consider passing a pointerId to it /// Note that for touch, IsPointerOverGameObject should be used with ''OnMouseDown()'' or ''Input.GetMouseButtonDown(0)'' or ''Input.GetTouch(0).phase == TouchPhase.Began''. /// </remarks> /// <example> /// <code> /// using UnityEngine; /// using System.Collections; /// using UnityEngine.EventSystems; /// /// public class MouseExample : MonoBehaviour /// { /// void Update() /// { /// // Check if the left mouse button was clicked /// if (Input.GetMouseButtonDown(0)) /// { /// // Check if the mouse was clicked over a UI element /// if (EventSystem.current.IsPointerOverGameObject()) /// { /// Debug.Log("Clicked on the UI"); /// } /// } /// } /// } /// </code> /// </example> public bool IsPointerOverGameObject(int pointerId) { return(m_CurrentInputModule != null && m_CurrentInputModule.IsPointerOverGameObject(pointerId)); }