Hello.
I’ve made a really simple inventory with PiDi’s tutorial but I don’t really know how would I nest my item icon (UI image) on specific position (let’s say next to the cursor) when I’m dragging it around my inventory. Right now I’m setting the local position of my icon with this script:
if(draggingItem)
{
Vector3 mousePos = (Input.mousePosition - GameObject.FindGameObjectWithTag("Canvas").GetComponent<RectTransform>().localPosition);
dragItemIcon.GetComponent<RectTransform>().localPosition = new Vector3(mousePos.x + 15, mousePos.y - 15, mousePos.z);
}
The problem is that the icon is not moving as fast as the mouse and sometimes it prevents me from dropping the item to one of the slots (because I’m actually clicking at the icon image, not the slot).
It looks like this: Imgur
I’d be very grateful for any bit of help!