Question by
Mazzaccherini · Oct 14, 2017 at 01:09 PM ·
drageventsystempointer
How to stop the current dragged GameObject?
Hi! I'm trying to implement a code to stop the actual GameObject dragging
I would like that after the code execution the pointerDrag field on the current EventSystem preview results null. This is the actual code I'm trying to use:
public void stopDragging () {
PointerEventData data = new PointerEventData(EventSystem.current);
ExecuteEvents.Execute<IEndDragHandler> (data.pointerDrag,
data, ExecuteEvents.endDragHandler);
}
But it seems doing absolutely nothing, and this doesn't return any error. How can make it working?
senzanome.png
(14.8 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612141026im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity UI create and drag with one click 0 Answers
How Can I Get An Event To Do It's Original Base Action As Well As My Code 1 Answer
How to stop object from going to center of mouse when dragging starts 0 Answers
PointerEventData.hovered blank when used with Right mouse button drag. 0 Answers
(Solved) OnPointerUp not called 1 Answer