micromissiles-unity/Assets/Scripts/UI/UIElementMouseCapturer.cs

26 lines
578 B
C#
Raw Permalink Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class UIElementMouseCapturer : EventTrigger
{
public override void OnPointerEnter(PointerEventData eventData)
{
InputManager.Instance.mouseActive = false;
base.OnPointerEnter(eventData);
}
public override void OnPointerExit(PointerEventData eventData)
{
InputManager.Instance.mouseActive = true;
base.OnPointerExit(eventData);
}
public void OnDisable()
{
OnPointerExit(null);
}
}