Circle Collider 2D not working

right now I have 2 objects in my scene (player and dog) both with 2D circle colliders and my player object with a rigidbody2d, I have “is trigger checked” on the dog object because I don’t want to delete it right away, but for the sake of time i just have it destroyed on collision. the script that i have attached to the player reads this
void OnTriggerEnter2D(Collider2D collider)
{
if(collider.gameObject.tag == “dog”)
{
Destroy(collider.gameObject);
}
}

i have been researching for an hour or two and nothing has worked any ideas?

First idea: Use code tags to make your code readable (the small icon with 101010).

Few general pointers for you:

  • Use Debug.Log() throughout your code to see what code gets executed and what not. On Monobehaviours you can use print()
  • Use gameObject.CompareTag() instead of gameObject.Tag == “query”, it doesn’t have to do a heap allocation like a normal string comparison would
  • Check if you dog is tagged dog, note that tags are case-sensitive
  • Try the same with OnCollisionEnter2D and see if the outcome changes