- Home /
move a specific object with finger in unity iphone.
Hello guys, i am trying hard to move an object on plane with my finger. but my code detect the touch of full iphone screen not just that object. can anybody please tell me how i can get the touch of that paticular object and move it on the screen with my finger.
my code is this.
var speed : float = 5;
function Update () {
for(var touch : Touch in Input.touches) { if(touch.phase == TouchPhase.Began) { Debug.Log("Finger has been touched...");
}
if(touch.phase == TouchPhase.Moved) {
Debug.Log("Finger is Moving...");
transform.position.x += Time.deltaTime * speed;
}
}
}
Comment