Hi guys I am new to iOS programming, and I am having a little problem with my drag and drop script. I am testing it on an iPad 3.
I have a guiTexture on screen and I want to touch it and move it around the screen. But things are not working as expected, when i touch the guiTexture and move my finger it actually moves the texture but does not follow my finger. I’ll leave my code here, I presume it’s because the touch.position cords are different from the actual position o the screen or something related, I’ll leave my script here, if someone can help it would be awesome!
if(touch.phase == TouchPhase.Moved && guiTexture.HitTest(touch.position))
{
Rect newInset=new Rect();
newInset.x=touch.position.x;
newInset.y=touch.position.y;
newInset.center=guiTexture.pixelInset.center;
newInset.height=guiTexture.pixelInset.height;
newInset.width=guiTexture.pixelInset.width;
guiTexture.pixelInset=newInset;
}