Input.mousePosition.x is not working properly I cant't find the reason.

private void FixedUpdate()
{

        if (Input.GetMouseButton(0))
        {
            transform.Translate(new Vector3(Input.mousePosition.x * Time.fixedDeltaTime * 0.05f, 0, speed * Time.fixedDeltaTime));
        }
    }

When the game starts, when I click left on the screen, the object moves to the right instead of to the left. When I right click, it goes right again, but faster. As far as I understand, it considers the leftmost part of the screen as the middle, but why?

[199731-adsız.jpg|199731]

What you are using are the screen coordinates for your mouse onto the world coordinates for your game.
Since these are two different coordinate systems, they won’t match too well.

Try using these coordinates from your mouse for your world:

Vector3 worldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
transform.Translate(new Vector3(worldPosition .x * Time.fixedDeltaTime * 0.05f, 0, speed * Time.fixedDeltaTime));

As a quick lazy fix you can add transparent buttons (invisible if you want) and move by that.

you can also try raycast to get where you’r actual mouse is in the world.

here is a good tutorial on that : How to get Mouse Position in 3D and 2D! (Unity Tutorial) - YouTube