Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tsuzukihashi/91292eaf48595c625cb1391625eb4480 to your computer and use it in GitHub Desktop.
Save tsuzukihashi/91292eaf48595c625cb1391625eb4480 to your computer and use it in GitHub Desktop.
//ボタンをタップした処理だけを実行するための関数
private bool IsPointerOverUIObject()
{
PointerEventData eventDataCurrentPosition = new PointerEventData(EventSystem.current);
eventDataCurrentPosition.position = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
List<RaycastResult> results = new List<RaycastResult>();
EventSystem.current.RaycastAll(eventDataCurrentPosition, results);
return results.Count > 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment