Why when touching the phone screen to change the player position the player is gone away vanish?

I want to make that where I touch with my finger on the phone screen the player will move to that position.

using UnityEngine;
using UnityEngine.UI;

public class MobileControls : MonoBehaviour
{
    private void Update()
    {
        if (Input.touchCount > 0)
        {
            Touch touch = Input.GetTouch(0);
            Vector3 touchPosition = Camera.main.ScreenToWorldPoint(touch.position);
            touchPosition.z = 0f;
            transform.position = touchPosition;
        }
    }
}

no matter if the camera is setting to perspective or to orthographic the player is just moving somewhere away far away from the camera.

the script is attached to the player.

on my phone android I’m using unity remote application and the Developer options enabled on my phone already.

Have you tested this with mouse inputs to see if your positioning is correct? It’s likely not the inputs, but your calculations.

Seems you are using Brackeys code.
Put some Debug.Log() messages between the commands to see what values your code is working with.

According to the documentation, the Z component of the screen space vector passed to ScreenToWorldPoint defines the depth of the returned world position relative to the camera.

Since you’re not setting the value of touchPosition.z, it’s probably placing the object right at the camera position (zero depth).