iPhone GUI buttons problem

Hello everyone,

I’ve created 4 GUI textures that will serve as input. 3 arrows and jump button. There’s a code attached to every texture:

function Update () { 
if(Input.touchCount > 0){

for(var i : int = 0; i < Input.touchCount; i++)
        var touch : Touch = Input.GetTouch(i);
            if(touch.phase == TouchPhase.Began && this.guiTexture.HitTest(touch.position)){
                //do something


    } else {
        //do something other


Now something about my problem. I can press them all at once, but when I release one button, it’s still pressed. Any idea how to solve it?

Use TouchPhase.Ended to know when the finger is lifted, and your button is released.