How i can check if boolean is false on a script that is on a gameobject that my raycast is pointing at? So I want to get boolean state using raycast. Raycast because I want to select exactly the right object because I have many of those same objects in the scene and I cant check boolean from all of them of just random one.
function Update () {
var hit:RaycastHit;
var ray:Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(ray,hit, 1000)) {
if(Boolean is false in a script that my raycast is pointing at){ //<-------------------------
if(Input.GetMouseButtonDown(0)){
Debug.Log("Select target");
hit.collider.gameObject.SendMessageUpwards("target");
}
}
}
}
Any idea? I hope you got the idea, I give more info if needed.
↧