There are two problems here. The first one is that you need a 'new' in front of your Vector3() in C#. The second is that the 'z' parameter must be the distance in front of the camera. In perspective mode at least, passing 0 will cause ScreenToWorldPoint() to always return the position of the camera. So the call will look something like:
worldPos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x,Input.mousePosition.y, 10.0f));
Note the measurement for the 'z' parameter is from camera plane to the playing surface plane. It is not the distance between the camera and the object. If the camera is aligned with the axes, then the distance is easy to calculate. If the camera is at an angle (i.e. not axes aligned), then ScreenToWorldPoint() is not the way to go.
Correction/Addition: Passing '0' will work fine to find the world x,y values if the camera is Orthographic. The 'z' will be the 'z' position of the camera.
原文地址:http://answers.unity3d.com/questions/599097/need-help-understanding-screentoworldpoint.html