x


What's the matter with this script? Detect object dragging with iPhone Touch

The script dosn't work, why?? I can't understand. The script should detect if an object is dragged or not and print it in the GUIText.


static var dragging : boolean = false; // contains true if the object is dragged

function Update()
{
   for (var touch : Touch in Input.touches) {
      if (touch.phase == TouchPhase.Began) dragging = true;
      else if(touch.phase == TouchPhase.Ended) dragging = false;
   }
   var targetText = GameObject.FindWithTag("txt");
   targetText.guiText.text = "is dragged = " + dragging;
}

more ▼

asked Nov 23 '10 at 09:46 PM

Andrea 3 gravatar image

Andrea 3
1 1 1 1

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first
more ▼

answered Jun 21 '11 at 01:23 AM

revelopment gravatar image

revelopment
61 1 1 1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1999
x1089
x577
x285
x96

asked: Nov 23 '10 at 09:46 PM

Seen: 1046 times

Last Updated: Jun 21 '11 at 01:23 AM