Created
April 20, 2017 14:34
-
-
Save n-taku/0208ddb430476bced981c38a0b909df9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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