- Home /
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; }
Answer by crevelop · Jun 21, 2011 at 01:23 AM
You might find this tutorial useful:
http://www.youtube.com/watch?v=oOfPMKdJdKk
I found the source code here:
http://www.revelopment.co.uk/tutorials/unitytutorials/73-howtorotateanobjectbytouch
Your answer
Follow this Question
Related Questions
Click Drag not working on iphone 2 Answers
Drag Player touch ios 2 Answers
How Can I Drag the Object With Touch ? (Mobile) 4 Answers
How do i make a continuos touch that triggers more then one "button"? 1 Answer
Touch and drag an object 0 Answers