Continuous shooting by holding iPhone button

I'm trying to create iPhone button that would continuously Instantiate bullets when finger touches this button and is held down, without conflicting with other buttons, for example, rotation joystick. At the moment I have this code that sends only one Message each time when button gets touched ( I also have script from 3rd Person Camera Prefab, which sends message when finger is RELEASED, but that one is much longer and more complicated). Maybe somebody has an idea how to keep sending message to target for few times per second untill finger is released from button...

Thanks in advance!

var recoveryTime = 10;

private var delay = 0;
var target : MonoBehaviour; //Target of the message to be sent 
var message : String ; //Message to be sent

function Update () {
    if (delay>0){delay -=1;}

    if (delay==0){
        if(iPhoneInput.touchCount == 1){
            var currentTouch:iPhoneTouch = iPhoneInput.touches[0]; 

            if(currentTouch.phase == iPhoneTouchPhase.Began && guiTexture.HitTest(currentTouch.position)){

                target.Invoke(message, 0);

                delay = recoveryTime;
            }
        }
    }
}

That code is only testing for TouchPhase.Began. Try allowing the phases Stationary and Moved as well. Or just check for the touch ending:

if ((currentTouch.phase != iPhoneTouchPhase.Ended 
     && currentTouch.phase != iPhoneTouchPhase.Cancelled)
  && guiTexture.HitTest(currentTouch.position)
{
    target.Invoke(message, 0);
    delay = recoveryTime;
}

Arguably you don't need to test the touch phase at all though. You might be able to fire if there's a touch in ANY stage as long as it's on the texture:

if (guiTexture.HitTest(currentTouch.position)
{
    target.Invoke(message, 0);
    delay = recoveryTime;
}

Phases are mostly used when detecting drags, zooms, or when you need fancy logic like, "cancel selection and start scrolling when they move their finger more than N pixels".

Hi, Can you please give me an example on how you managed to implement the joystick and a fire button on this? I am working on a 2d shooter also but can't figure it out the movement (joystick) code :( Thanks