Drag and Drop GUITexture iOS IPad

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;
				
       }

I finally got my script to work like a charm! But u have to set x and y values on the transform to 0;

Here it is!

if(touch.phase == TouchPhase.Moved && guiTexture.HitTest(touch.position))

   {
			Rect newInset = new Rect(       guiTexture.pixelInset.x+touch.deltaPosition.x,
									guiTexture.pixelInset.y+touch.deltaPosition.y,
									guiTexture.pixelInset.width,
									guiTexture.pixelInset.height);
			
			guiTexture.pixelInset=newInset;
			
	}

I finally got my script to work like a charm! But u have to set x and y values on the transform to 0;

Here it is!

if(touch.phase == TouchPhase.Moved && guiTexture.HitTest(touch.position))

   {
			Rect newInset = new Rect(       guiTexture.pixelInset.x+touch.deltaPosition.x,
									guiTexture.pixelInset.y+touch.deltaPosition.y,
									guiTexture.pixelInset.width,
									guiTexture.pixelInset.height);
			
			guiTexture.pixelInset=newInset;
			
	}