Is there something particular to take action that drag managers work in my person interface?
I’ve an eventhandler, a canvas with a GraphicicsRayCaster, and the canvas has 2 kids, each textMeshpro buttons. Each buttons have the textMeshpro textual content photos with which they arrive, and one in every of them additionally has a picture youngster. The buttons have the interactable field marked.
Utilizing the next code, I don’t obtain debugging registration messages:
utilizing UnityEngine;
utilizing UnityEngine.EventSystems;
public class OnDragTest : MonoBehaviour, IBeginDragHandler, IEndDragHandler
{
public void OnBeginDrag(PointerEventData eventData)
{
Debug.Log("BEGIN");
}
public void OnEndDrag(PointerEventData eventData)
{
Debug.Log("END");
}
}
I suppose the script should hook up with any person interface aspect for which I wish to deal with the drag, however solely to be sure that I didn’t miss one thing, I additionally added it to the canvas and the occasion system. Then, now the occasion system, the canvas and all of the descendants of the hierarchy of scenes of the canvas have the undragtest element. Nothing nonetheless.
The buttons might be click on. If I add a name return within the Onclck of the button element, the press happens and works properly.
All I would like is to deal with drag occasions. What different hoops do I’ve to leap to get there?