Drag object error...!!!

Hi,
The Target:
suppose there is a plane object and we want drag and drop it with mouse cursor, i found the following code but it gave me error:
Code:

private var currTarget: Transform;
private var dragging: boolean;
private var clickOffset: Vector3;


function Update () {
	var objPlane: Plane;
	var hitDist: float;
	var hit: RaycastHit;


			if (Input.GetMouseButton(0)  gameObject.name =="Plane")  {
		ray = Camera.main.ScreenPointToRay(Input.mousePosition);

		if (dragging) {	
			objPlane = new Plane(Camera.main.transform.forward, currTarget.position);
			objPlane.Raycast(ray, hitDist);
			currTarget.position = ray.GetPoint(hitDist) + clickOffset;
		} else if (Physics.Raycast(ray, hit)  Input.GetMouseButtonDown(0)  hit.transform.name == "Plane"){
			dragging = true;
			currTarget = hit.transform;
			
			objPlane = new Plane(Camera.main.transform.forward, currTarget.position);
			objPlane.Raycast(ray, hitDist);
			clickOffset = currTarget.position - ray.GetPoint(hitDist);
		}
	} else {
		dragging = false;
	}
}

Console Output:

NullReferenceException
UnityEngine.Camera.ScreenPointToRay (Vector3 position)
dragObject02.Update () (at Assets/Scripts/dragObject02.js:13)

what is the wrong in the code???

no answer …!!!

You may not have a main camera in your scene (ie, one that has “MainCamera” as its tag). This may be the case if you have removed the default camera and added your own new one to the scene. If this is the case, you can fix it by adding the tag to the camera you want to use for the raycast or else by passing the camera into the script using a variable.