Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class EventTriggerDelegateEx : MonoBehaviour
{
void Start( )
{
EventTrigger trigger = GetComponent<EventTrigger>( );
EventTrigger.Entry entry = new EventTrigger.Entry( );
entry.eventID = EventTriggerType.PointerDown;
entry.callback.AddListener( ( data ) => { OnPointerDownDelegate( (PointerEventData)data ); } );
trigger.triggers.Add( entry );
}
public void OnPointerDownDelegate( PointerEventData data )
{
Debug.Log( "OnPointerDownDelegate called." );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment