- Home /
Setting parent with SetParent but ignoring the new parents position
In our game I got Items which can be dragged via DragHandler (OnBeginDrag, OnDrag and OnEndDrag). If the Player ist dragging an item into another Slot outside the inventory, the parent of the item is set to the new Slot. Now when the Player wants to drag the item back into the Inventory, the item is behind the Inventory Picture (Hierarchy). I solved that Problem by changing the parent in the OnBeginDrag and making it SetAsLastSibling. The Problem is, the item is following inside OnDrag the Position of mouseinput but jumps with the SetParent on Position 0,0,0 inside the canvas (which is assigned as the new parent) and afterwards while dragging away back to the mouseposition.
Can I ignore somehow inside SetParent the Position of the parent? Making the bool false of it ("worldPositionStays") doesn't work. It jumps to another Position too.
well, that bool should be true, you want it to stay where it was right?
Your answer
![](https://koobas.hobune.stream/wayback/20220612183749im_/https://answers.unity.com/themes/thub/images/avi.jpg)