Created
July 10, 2018 13:57
-
-
Save walterpalladino/83949f91d4effaeda7832ccc90687e8e to your computer and use it in GitHub Desktop.
Detect Taps on UI Elements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.EventSystems; // Required when using Event data. | |
public class ClickableUIObject : MonoBehaviour, IPointerDownHandler, IPointerUpHandler { | |
public bool clicked = false; | |
public void OnPointerDown (PointerEventData eventData) | |
{ | |
Debug.Log("OnMouseDown"); | |
clicked = true; | |
} | |
public void OnPointerUp(PointerEventData eventData) | |
{ | |
Debug.Log("OnPointerUp"); | |
clicked = false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment