I wanna SetOnClick for UnityEngine.UI.Text and UnityEngine.UI.Image, but I try following code, and click Text or Image, not available data in PointerEventData
public class TestClickText : MonoBehaviour, IPointerClickHandler
{
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void OnPointerClick(PointerEventData eventData)
{
var r = eventData;
}
}
I know I can in Button object add Image or Text to make them clickable, but its too tedious, so I hope a way to implement like UnityEngine.UI.Text#SetOnClick