Multi-touch on different screen halves

Hi! I am trying to make a spaceship thrust and shoot dependant on which screenhalf I touch. I’ve made the touch work so the ship moves when i touch the left half and shoots when I touch the right half. The problem comes when I try to let go of either of them, then nothing happens unless I let go of both sides. Or in another variation, the thrust never stopped. How can I register if left half or right half was released? Currently I wrote the code so I need to let go of both, but I’ve tried so many variations and nothing works…

Here is a simplified version of my code:

	public Rect leftScreen = new Rect(//position);
	public Rect rightScreen = new Rect(//position);
	
	void Update () {

		if(Input.touchCount > 0)
		{
			touch = true;

			if(leftScreen.Contains(Input.GetTouch(0).position) || leftScreen.Contains(Input.GetTouch(1).position))
			{
					startThrusters();
			}
			
			if(rightScreen.Contains(Input.GetTouch(0).position) || rightScreen.Contains(Input.GetTouch(1).position))
			{
				//Fire Weapons
			}
		}

		if(Input.touchCount <= 0)
		{
			stopThrusters();
		}

Well, if you have both fingers on the screen left and right, then you have Input.touchCount equal to 2. If you let up on the left, I guess you want to stop your thrusters, but Input.touchCount will equal 1, so your code will not be called. And anyway, I think your code is a bit unsafe. If you have only a single finger down, then Input.touchCount will be 1, but in your one 10 you ask for the second touch, which is surely going to break? I think you’ll want to use the various touch phases, so you know the finger has been lifted if you get a TouchPhase.Ended.