Click and Drag Camera only works in Orthographic camera

I was working on a click and drag script to move the Camera around. It works perfectly with an Orthographic Camera, but when I try to change it back to a Perspective Camera, it doesn’t work at all and I don’t understand why.

Here’s my script attached to the camera:

function Update () {

if ( Input.GetMouseButtonDown(0)){
	dragOrigin = Vector3 (Input.mousePosition.x, Input.mousePosition.y, 0);
	dragOrigin = camera.ScreenToWorldPoint(dragOrigin);

if ( Input.GetMouseButton(0)){

	var currentPos : Vector3 = Vector3 (Input.mousePosition.x, Input.mousePosition.y, 0);
	currentPos = camera.ScreenToWorldPoint(currentPos);
	var movePos : Vector3 = dragOrigin - currentPos;
	transform.position = transform.position + movePos;


Just read the docs. For a perspective cam, you must provide a z distance for Camera.ScreenToWorldPoint, at which you want to place your object.