I have a quad set in a menu scene. I want it to be clickable. I’m using:
void Update () {
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
var hit : RaycastHit;
if(Physics.Raycast(ray,hit)){
if(hit.collider.tag == "Quad"){
//hit.collider.gameObject now refers to the
//cube under the mouse cursor if present
if(Input.GetMouseButtonDown(0))
Application.LoadLevel("TitleScreen");
}
}
}
But when I go to compile, I get the following on my line of ‘var hit : RaycastHit;’ :
Unexpected symbol :', expecting
)‘, ,',
;’, [', or
=’
I have the script assigned to the quad itself. I know the click part works - but my first iteration included clicks anywhere on the screen. The quad itself is invisible and lying over a section of a flat image that has the menu option.
Thoughts?