Player moving opposite direction when there is a new touch.

So I divided the screen into 2 spaces. Whichever side is pressed, the player will move in that direction. The problem I have is that when there is a finger on one side, and another side is touched, then the player will move to that side. I do not want this.

float h = 0f;

if (Input.touchCount > 0)
{
    Touch firstTouch = Input.GetTouch(0);
    if (firstTouch.position.x > HalfOfScreenWidth)
        h = 1f;
    else
        h = -1f;
 }

In order to find a touch that just happened you need to iterate through all of them and find the one whose phase is TouchPhase.Began

There is an example at the bottom of the page here:

You should check Touch.fingerID and Touch.phase. When the current touch is not ended, you can just ignore other touches.