Help with iphoneInput.touch.phase

After looking over the iphone touch system, it looked really simple, but after trying to apply it, nothing seems to make sense.

my code goes something like this:

for (var touch : iPhoneTouch in iPhoneInput.touches)
{
    joyTouch = touch;
}

if (joyTouch.phase.Began)
    //save the initial joystick spot
if (joyTouch.phase.Moved || joyTouch.phase.Stationary)
    //save where the joystick is now
if (joyTouch.phase.Ended)
    //save that the joystick is not in use

Right now, im trying to make a joystick. To do this i really need to use the iPhoneTouch.phase .
After using debug.Log, i’ve found out that within the for loop, stationary, moved, and ended are always true if there is a finger touching the screen and began is never true. If it’s outside of the for loop, stationary, moved, and ended are always true, even before a finger has ever touched the screen even at the start of the game.

I’m confused, can someone help me out? thanks.

wanna try this?
check if the phases are working as intented.
this line works for me

iPhoneTouch touch = iPhoneInput.GetTouch(0)
if (touch.phase == iPhoneTouchPhase.Moved)
{
 // do something 
}

ok, that helps, but the touch is only saved once. It seems that the var joyTouch can be saved as a touch, but can’t be changed to a different touch after that?

is there a way to set the joyTouch to null or something like that?

yey, i got it! i just used a

for (var i = 0; i < count; i++)

kind of loop and used iPhoneInput.GetTouch(i)

works great.

ohh, thats nice :smile:
was gonna suggest that but you beat me to it :smile: