Tim
0
Q:

why raycast is not hitting a 2d object unity

 //Have to use 2D version in 2D scenes.
 //Object must have a collider.
 RaycastHit2D hit = Physics2D.Raycast(transform.position, Vector2.down);
         if ((hit.collider != null) && (Input.GetMouseButtonDown (0))) 
         {
             print ("This hit at " + hit.collider.name);
         }



2

New to Communities?

Join the community