Hi there. I have a problem with drag an object relative to parent in UI. anybody knows how can I convert according to UI. this code works in-game but does not work in UI
I’m not sure I’m understanding. When you say “it doesn’t work in UI” you mean it doesn’t work outside PlayMode?
If you want something to execute in Editor mode, you must put a this above your class [ExecuteInEditMode]. Unity - Scripting API: ExecuteInEditMode
dragging object relative to parent object does not work properly. so, it works but not properly. when I start dragging, the cursor is another side, the object is another side
You should try to give more info, maybe you could post some pictures or video that better describes your problem. It’d be good to see the hierarchy and scene.
Could it be that you’re setting the circle’s local position instead of world?
Does it follow it properly in game mode?
Is it off by always the same amount? If that’s the case you could set an offset.
It does not work in canvas because canvas is scaled relative to screen size probably. You need to use RectTransformUtility to convert coordinates from wolrd or screen space to canvas position inside some rect. After you have the coordinates, you can set anchoredPosition of the rect transform you dragging.
I made it thanks for it. but now does not work pointenter and the others. because I want to drag with touch to object and If my finger exit from object, it will stop. Also following path does not work with bezier. If I send you my script, would you help me?