title: "An object reference is required for the non-static field, method, or property" in Unity 2019.2.4f1
body: <p>Unity is throwing out this compiler error when I run my code </p>
  
  <blockquote>
    <p>"Assets\Stealth.cs(25,13): error CS0120: An object reference is
    required for the non-static field, method, or property
    'RaycastHit2D.collider'"</p>
  </blockquote>
  
  <p>I've tried declaring the RaycastHit2D variable in multiple different ways, and all throw out a different error.</p>
  
  <pre><code>public float rotationSpeed;
  public float distance;
  
  private void Start()
  {
      Physics2D.queriesStartInColliders = false;
  }
  
  
  void Update()
  {
      transform.Rotate(Vector3.forward * rotationSpeed * Time.deltaTime);
  
      if(RaycastHit2D.collider.CompareTag("Player")){
          Destroy(RaycastHit2D.collider.gameObject);
      }
      RaycastHit2D RaycastHit = Physics2D.Raycast(transform.position, transform.right, distance);
      if (RaycastHit2D.collider != null){
          Debug.DrawLine(transform.position, RaycastHit2D.point, Color.red);
      } else {
          Debug.DrawLine(transform.position, transform.position + transform.right * distance, Color.green);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>It should cause a gameObject I have in the scene to destroy the player when the ray comes in contact with the player's 2D collider, and this isn't happening.</p>