Version: 2018.2
public void OnPointerClick (EventSystems.PointerEventData eventData);

パラメーター

eventData現在のイベントデータ。

説明

Use this callback to detect clicks.

Make sure you have an Event System in your Scene.

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!"); } }