Hey thank you for the script it's exactly what i was after, only thing i'm struggling to get it so it doesn't centre on mouse click. I would like the component to move from where the mouse is clicked. any ideas how i could do this please?
As Matthew mentioned in the original post, all you need to do is capture an offset value on click and add that offset to the position change in the Update() method.
You can also circumvent using an Event System by inheriting from MonoBehavior and the pointer up/down handler interfaces instead of an EventTrigger.
Hey thank you for the script it's exactly what i was after, only thing i'm struggling to get it so it doesn't centre on mouse click. I would like the component to move from where the mouse is clicked. any ideas how i could do this please?
As Matthew mentioned in the original post, all you need to do is capture an offset value on click and add that offset to the position change in the Update() method.
You can also circumvent using an Event System by inheriting from MonoBehavior and the pointer up/down handler interfaces instead of an EventTrigger.
So: