- Home /
iphone input
ok i have a really simple question from which i cant seem to get an answer. all i want is to be able to detect touch on a certain spot on the screen, like a gui for example.
so far i have came up with a few things but dont work efficiantly so i need an answer to solve this little puzle..all i want to be able to do is touch on one gui and touch on another gui at the same time shouldnt be to difficult should it.
Answer by reptilebeats · Jan 20, 2012 at 12:58 AM
ok so i managed to find out what is wrong with my code
var count : float = 0;
function Update (){
for (var i = 0; i < Input.touchCount; ++i)
var touch : Touch = Input.GetTouch(i);
if (touch.phase == TouchPhase.Stationary && guiTexture.HitTest(touch.position)){
count = count +1;
print(count);
}
}
this will not allow duel touch however after a bit of research and a lot of fiddling i have found that this code will work for detecting touch on gui....
var count : float = 0;
function Update (){
for (var i = 0; i < Input.touchCount; ++i){
var touch : Touch = Input.GetTouch(i);
if (touch.phase == TouchPhase.Stationary && guiTexture.HitTest(touch.position)){
count = count +1;
print(count);
}
}
}
Your answer
Follow this Question
Related Questions
GUI texture touch to input 1 Answer
Input.GetTouch SOMETIMES not registering on iOS 0 Answers
How to offset Input.Acceleration by 90 degrees 1 Answer
iPhone input multitouch 1 Answer
Detecting touches in a Rect on iOS 2 Answers