Question by 
               Nick_Rizzo · Sep 28, 2015 at 06:40 AM · 
                unity 5javascriptscripting problemraycastscriptingbasics  
              
 
              Can not get my raycast to detect an object
So I have a raycast script attached to an empty game object I can see the Debug.DrawRay but when my player walks into it the debug.log does nothing here is my code:
 function Update ()
 {
    
     Debug.DrawRay (transform.position, Vector3.forward * 10, Color.green);
     var hit : RaycastHit;
     if ( Physics.Raycast( transform.position, transform.forward, hit, 100.0 ) )
     {    
       
         if (hit.collider.tag == "Player")
         {
             Debug.Log("HIT!!!");
         }
         
     }
 
 
 }
               Comment
              
 
               
              Try if(hit.transform.gameObject.tag == "Player") ins$$anonymous$$d of if(hit.collider.tag == "Player") 
Your answer
 
 
             Follow this Question
Related Questions
OnCollisonEnter2D Not Firing after checking collider 1 Answer
JavaScript Problem - BCE0043 - Unexpected Token Help 0 Answers
How to set a special prefab in a switch? 1 Answer
Next Level Using numbers 5 Answers
How would i set the player var? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                