camera.main update problems with screenToWorldPoint

Hi There,

I am a bit stuck with the following problem:

I am trying to get a line renderer working by creating a world object from mouse/touch screen coordinates (screenToWorldPoint). For debugging I use a GUITexture, displaying the coordinates. Problem is, that when I use camera.current, the counter updates fine only in scene view (not game view window) (but the usual problems with the camera.current being sometimes null occur) → so naturally i use camera.main, but then the counter stops updating completely (i only get a single first value)… no idea what i am doing wrong here (using os x lion for testing)

script for the mouse coordinate to world coordinate conversion and counter display

var text : GUIText;

function Update () {
	var mpos : Vector3 = Camera.main.ScreenToWorldPoint(Input.mousePosition);
	text.text = "X:"+mpos.x+" - Y:"+mpos.y;
} 

[Edit:] Simplification
Script attached to an empty GameObject in the scene:

function Update() {
        Debug.Log("world:"+Camera.main.ScreenToWorldPoint(Input.mousePosition)); //no updates
        Debug.Log("screen:"+Input.mousePosition); //updates fine
}

Found a solution:

@syclamoth: Thanks for the help!

This does not update correctly

  Debug.Log(Camera.main.ScreenToWorldPoint(Input.mousePosition))

but this does

  Debug.Log(Camera.main.ScreenToWorldPoint(Vector3(Input.mousePosition.x, Input.mousePosition.y, 1)));

Not sure where the problem is though :frowning:
I assume the actual documentation for Input.mousePosition is not 100% accurate and it might return no or out-of-bounds values for the z-component of the Vector3.