- Home /
script not reading instructions
my script is not reading the second if condition ! (if ( hit.transform.tag == "Enemy")) i have a gameobject tagged with " Enemy " !
function Update () { if ( Input.GetMouseButtonDown(0)) { var direction = Camera.main.ScreenPointToRay(Input.mousePosition); var hit : RaycastHit; if (Physics.Raycast(direction, hit, 100)) { if ( hit.transform .tag == " Enemy") { print(" hi "); } } } }
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613082956im_/https://answers.unity.com/themes/thub/images/avi.jpg)