public class UIGraph : MonoBehaviour,
IPointerDownHandler
{
public virtual void OnPointerDown(PointerEventData eventData)
{
DoStuff();
}
}
The Behaviour Script is attached to a UI-Object. The script is working as intended in the editor. If I build my application and run the executable, DoStuff will not be called (atleast I cant see the result of it beeing called). Am I using a debug only interface? Is this a bug?
@gffdgfdfgdgg
I am experiencing the same thing currently. I am using the Canvas and have children objects with scripts that implement the IPointerDownHandler interface.
Everything works as intended in the editor however the built executable does not trigger the handlers.
Did you ever get this to work or figure out what was wrong?
Don’t know if this will solve it for you, but there is another way to listen to OnPointerDown. You can add a Event Trigger on the UI object, and then add a call to a method that handles it.
And the PointerListerner scripts looks like this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class PointerListener : MonoBehaviour {
public void OnPointerDown(BaseEventData baseEventData)
{
Debug.Log("Do stuff");
}
}