Version: 2018.4
public static GameObject GetEventHandler (GameObject root);

パラメーター

rootルートにある GameObject

戻り値

GameObject 処理する GameObject

説明

ルート から始まるオブジェクトの階層を走査し、T 型のイベントハンドラーを実装する GameObject を返します。

注意: 走査はルートオブジェクトから下方に向かってではなく、上方に向かって行われます。

using UnityEngine;
using UnityEngine.EventSystems;

public class GetEventHandlerExample : MonoBehaviour { // Find the GameObject which implements IDragHandler

void Start() { GameObject handlerObject = ExecuteEvents.GetEventHandler<IDragHandler>(this.gameObject);

if (handlerObject == null) Debug.Log("Drag Handler not found."); else Debug.Log("Drag Handler is attached to GameObject '" + handlerObject.name + "'"); } }