My script is attached to a character controller.
And i declared
public Camera camera;
in class.
In update function i given
if(Input.GetMouseButtonDown(0)){
Ray ray = camera.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast (ray, out hit3, 400.0F)){
print(hit3.collider.gameObject.name);
}
}
But i am getting error
"UnassignedReferenceException:
The variable camera of 'characterScript' has not been assigned.
You probably need to assign the camera variable of the
characterScript script in the inspector."
Help me with a good solution.
Thanks in Advance