Error for my 2D Raycast..

I am projecting a Raycast from a 2D sprite and i am getting this error?
2900226--213486--upload_2016-12-28_18-48-6.png

Here is my code:

Does anyone have any ideas on how I can remove this error? Doesn’t seem to be breaking the game but I want to get rid of it ASAP.

the raycast can hit objects that don’t have colliders so you should use a null check

if ( hit.collider != null )
            {
                Debug.Log( hit.collider.name ); //hit something with a collider
                 if(hit.collider.tag == "Ground")
                 {
                    Debug.Log( "Hit the Ground" ); 
                  }
            }
1 Like

Did it fix the issue?