Created
October 25, 2015 11:53
-
-
Save anzfactory/e5fc2ec4fbf23f9ab385 to your computer and use it in GitHub Desktop.
unityでタップされたオブジェクト処理てきな
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 UnityEngine; | |
using UnityEngine.Events; | |
using UnityEngine.EventSystems; | |
public class ClickHandler : MonoBehaviour, IPointerClickHandler | |
{ | |
[SerializeField] | |
private ClickEvent clickHandler; | |
public void OnPointerClick(PointerEventData eventData) | |
{ | |
this.clickHandler.Invoke(this.gameObject); | |
} | |
public void AddClickHandler(UnityAction<GameObject> handler) | |
{ | |
this.clickHandler.AddListener(handler); | |
} | |
[System.Serializable] | |
public class ClickEvent : UnityEvent<GameObject> {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment