Trouble with touch c#

I’m having trouble with writing a touch script in c# that allows for 2 touches. Lets say touch “A” is move and touch “B” is fire. Touch “A” is linked to a simple touch pad much like the one in the Space Shooter tutorial, same for touch “B”. Here’s the problem tho… everything works fine so long as touch “A” is first or touch “B” is held. But if touch “B” is first then touch “A” is held while touch “B” is released then touch “A” fails. I know why it fails, but I can’t seem to find a way to fix it. If anyone could help or at least point me in the right direction…

Post your code!

void FixedUpdate()
{
touch = movementZone.GetTouch ();

if (movementZone.CanMove () && Input.GetTouch (touch).phase == TouchPhase.Moved)
{
Vector2 direction = Input.GetTouch (touch).deltaPosition;
Vector3 movement = new Vector3 (direction.x * speed, direction.y * speed, 0);
transform.Translate(movement * Time.deltaTime * smoothing);
}

Here’s the code I’m having trouble with. it usually gives an error on the Vector 2 direction line…

Use the Touch.fingerId to identify your touches. It is persistent through the entire duration of the touch.

The problem with using the index of Input.GetTouch as a persistent mean is this:
Imagine you touch the screen with a finger, it will take the index 0 in the input.touches array. Then, you add another finger onto the screen, it will take the value 1. If you then release the first finger, the second finger becomes 0 since the original 0 is gone. If you cached 1 and are using this to refer to the touch, you’ll run into an error.