Raycasting with LayerMask gives me a bce0023

hello again:
I have a problem casting a ray, looking up other bce0023 seem mostly caused by typo erros, but i cannot find what is wrong with the following script. i even tried creating the ray and all the variables inside the case, but it gives me the same error:

BCE0023: No appropriate version of
‘UnityEngine.Physics.Raycast’ for the
argument list ‘(UnityEngine.Ray,
System.Type, float, int)’ was found.

	var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);
	var hit = RaycastHit;
	var layerMask = 1 << 8;	//ignoring all but the gui clickable layer
		case MouseState.select :
		if (Physics.Raycast(ray,hit,Mathf.Infinity,layerMask)) {
						selected = hit.transform.parent.transform;		//assigning clicked object
						selected = null;	//deselecting since we hit environment

I am always happy if you have a better way of coding this. I am trying to handle all the user input via switch and a mouseState that can change to different actions, depending on what the mouseCursor is.

As the error message says, you’re giving it a Ray, Type, float, and int, but if you look at the docs, you see you need a Ray, RaycastHit, float, and int. Writing “var hit = RaycastHit;” assigns a Type to the hit variable, but you don’t want to assign anything to it, you just want to declare the type, namely “var hit : RaycastHit”.