eventData | Current event data. |
Use this callback to detect clicks.
Make sure you have an Event System in your Scene.
no example available in JavaScript
using UnityEngine; using UnityEngine.EventSystems;
public class Example : MonoBehaviour, IPointerClickHandler { //Detect if a click occurs public void OnPointerClick(PointerEventData pointerEventData) { //Output to console the clicked GameObject's name and the following message. You can replace this with your own actions for when clicking the GameObject. Debug.Log(name + " Game Object Clicked!"); } }
Did you find this page useful? Please give it a rating: