- Home /
Question by
oinkoinkflapflap · Feb 21, 2011 at 08:56 PM ·
javascriptdistancelayerstagsnearest
distance script work with nearest tags
could i get this script to work when i'm near a certain tag or layer instead of just 1 object,
var box : Transform;
function Update () { var dist : float = Vector3.Distance(box.position, transform.position); if(dist <= 20){ GetComponent("veahcle script 3").enabled = true; }else{ GetComponent("veahcle script 3").enabled = false; }
}
thanks all!!!!!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613105546im_/https://answers.unity.com/themes/thub/images/avi.jpg)