Is Pointer over UI#
Input / Is Pointer over UI
Can Read
Cannot Write
Description#
Returns true if the pointer is currently on top of a user interface element
Code#
using System;
using UnityEngine.EventSystems;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Is Pointer over UI")]
[Category("Input/Is Pointer over UI")]
[Description("Returns true if the pointer is currently on top of a user interface element")]
[Image(typeof(IconUnityUI), ColorTheme.Type.Blue)]
[Keywords("Cursor", "Mouse", "Touch", "Canvas", "Hover", "Blocked")]
[Serializable]
public class TypeBoolInputPointerOverUI : TypeBool
{
public override bool Get(Args args)
{
EventSystem eventSystem = EventSystem.current;
return eventSystem != null && eventSystem.IsPointerOverGameObject();
}
public override string ToString()
{
return "Pointer over UI";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}