Hi,
i’m using Raycast to detect object with tag “magicBox” - if object is detected i execute function in script attached to boxes tagged as “magicBox”. My problem is - SendMessage executes function on all boxes on scene - not as it supposed - only on one detected with Raycast. Any ideas ?
if(Physics.Raycast(transform.position, downVect, hit,10)){
if(hit.collider.gameObject.tag == "magicBox"){
hit.collider.gameObject.SendMessage("myFunction");
}
}