Camera.WorldToScreenPoint problem

Hi,

I copy paste this code from the docs :

Camera

But i have this error :

Ambiguous reference ‘camera’: Camera_Positions.camera, UnityEngine.Component.camera.

I use Unity 5.

Thanks for your help.

Hehe Outdated script. Try this :

#pragma strict
public var target: Transform;
var cam: Camera;
function Start() {
	cam = GetComponent.<Camera>();
}
function Update() {
	var screenPos: Vector3 = cam.WorldToScreenPoint(target.position);
	Debug.Log("target is " + screenPos.x + " pixels from the left");
}