title: OnTriggerEnter2D doesn't work at all. Unity This message parameter has to be type of Collider2D
body: <p>I'm apparently doing something wrong. Unity is giving me:</p>
  <blockquote>
  <p>Script error: OnTriggerEnter2D This message parameter has to be of
  type: Collider2D</p>
  </blockquote>
  <p>I have a BoxCollider on an empty object that is a child of my player. When it collides nothing happens. I've set IsTrigger to true.</p>
  <p><strong>Player's child script:</strong></p>
  <pre><code>public class EnemyHurtCollider : MonoBehaviour
  {
      private Rigidbody2D rb;
      private Collider2D coll;
      private void Start()
      {
          GameObject.Find(&quot;Player&quot;).GetComponent&lt;PlayerController&gt;();
          rb = GameObject.Find(&quot;Player&quot;).GetComponent&lt;Rigidbody2D&gt;();
          coll = GetComponent&lt;Collider2D&gt;();
      }
      public void OnTriggerEnter2D(Collision2D other)
      {
          if (other.gameObject.tag == &quot;Enemy&quot;)
          {
              GameObject.Find(&quot;Player&quot;).GetComponent&lt;PlayerController&gt;().state = State.hurt; //state hurt
              if (other.gameObject.transform.position.x &gt; transform.position.x)
              {
                  Debug.Log(&quot;HURT&quot;);
                  //if enemy is to my right when colliding I should be damaged and move left
                  rb.velocity = new Vector2(-GameObject.Find(&quot;Player&quot;).GetComponent&lt;PlayerController&gt;().hurtForce, rb.velocity.y);
              }
              else
              {
                  Debug.Log(&quot;HURT&quot;);
                  //if enemy is to my left when colliding I should be damaged and move right
                  rb.velocity = new Vector2(GameObject.Find(&quot;Player&quot;).GetComponent&lt;PlayerController&gt;().hurtForce, rb.velocity.y);
              }
          }
      }
  }
  </code></pre>