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:
Assets/_Weapons/Scripts/PlayerControls.js(80,44):
BCE0023: No appropriate version of
‘UnityEngine.Physics.Raycast’ for the
argument list ‘(UnityEngine.Ray,
System.Type, float, int)’ was found.
if(Input.GetMouseButtonUp(0)){
var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit = RaycastHit;
var layerMask = 1 << 8; //ignoring all but the gui clickable layer
switch(mouseState){
case MouseState.select :
soundPlayer.PlaySound(soundClick,0,0);
if (Physics.Raycast(ray,hit,Mathf.Infinity,layerMask)) {
if(!hit.transform.tag=="Environment"){
selected = hit.transform.parent.transform; //assigning clicked object
}
else{
Instantiate(deselectParticles,hit.point,Quaternion.Identity);
selected = null; //deselecting since we hit environment
}
UpdateGUI();
}
break;
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.