Hey :p. I’m creating 3d shooting game, but my script about raycast shooting did’nt work. It’s it:
function Update () {
if (Input.GetMouseButtonDown(0)) {
var hit: RaycastHit;
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, hit)) {
Destroy(hit.gameobject);
}
}
}
My problem is error, when i’m trying “throw” ray. It’s this error message:
It’s every time when i trying press left button.
PLEASE HELP!
PS. Sorry if my english is not perfectly.