Start OnDrag() from script
Hello, can I somehow start the function IDragHandler.OnDrag(PointerEventData eventData) from script on another GameObject? I have one object that I am clicking on and second, that needs to be dragged after that click. And yes, I need to have the scripts separated (clicking on the first, dragging on the second).
I am trying to call it with ExecuteEvents.Execute<>(), but with no success.
There is that code. The target object is ammoSelected and has that OnDrag() function implemented. This is code from the first object, that is beeing clicked.
PointerEventData current = new PointerEventData(EventSystem.current);
ExecuteEvents.Execute<IPointerDownHandler>(ammoSelected, current, ExecuteEvents.pointerDownHandler);
ExecuteEvents.Execute<IBeginDragHandler>(ammoSelected, current, ExecuteEvents.beginDragHandler);
ExecuteEvents.Execute<IInitializePotentialDragHandler>(ammoSelected, current, ExecuteEvents.initializePotentialDrag);
Comment