Skip to content

Instantly share code, notes, and snippets.

@n-taku
Created April 20, 2017 14:34
Show Gist options
  • Save n-taku/0208ddb430476bced981c38a0b909df9 to your computer and use it in GitHub Desktop.
Save n-taku/0208ddb430476bced981c38a0b909df9 to your computer and use it in GitHub Desktop.
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