To UIDragObject I add the follow lines:
1) clamp vars
public Vector3 minOffset = new Vector3 (0,0,0);
public Vector3 maxOffset = new Vector3 (0,0,0);
2) In OnDrag (Vector2 delta) I add in lines:
else
{
// Adjust the position
target.position += offset;
// MY CLAMP FUNCTION
target.position = new Vector3 (Mathf.Clamp(target.position[0], minOffset[0], maxOffset[0]), Mathf.Clamp(target.position[1], minOffset[1], maxOffset[1]), Mathf.Clamp(target.position[2],minOffset[2], maxOffset[2]));
}
Using this line however I don;t understand how minOffset = -1.4 is equal to the max distance from bottom.
If i print (delta) when I drag until the end bottom, it print -1.4 and top end is equal to 0.25 ...