Camera.WorldToScreenPoint problem


I copy paste this code from the docs :


But i have this error :

Ambiguous reference ‘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");