How To Destroy Collision Object In This Code

Hello im trying to make a small game like you see in the video.
I want to destroy the player when enemy collided with it. (Player is square / Enemy is circle)

I tryed collision as you see in code but it didnt worked.

all of them has colliders (box and circle collider)

    void Update()
    {
        transform.position = Vector2.MoveTowards(transform.position, moveposition.movepos[moveposIndex].position, speed * Time.deltaTime);

        if (Vector2.Distance(transform.position, moveposition.movepos[moveposIndex].position) < 0.1f)
        {
            if (moveposIndex < moveposition.movepos.Length -1)
            {
                moveposIndex++;
            }
            else
            {
                Destroy(gameObject);
                Debug.Log("Damage given");

            }
        }
        if (Input.GetMouseButtonDown(0))
        {
           // Destroy(gameObject);
        }
    }

    //private void OnCollisionEnter2D(Collision2D collision)
    //{
    //    Destroy(collision.gameObject);
    //}

}

Rule#1: You should never modify the Transform when using 2D physics. If it moves then move the Rigidbody2D using its API. The Rigidbody2D role is to update physics and write the results to the Transform itself.

It just looks like you’ve added two Static (meaning non-moving) Colliders and are modifying the Transform. This isn’t “moving” in a physics sense, it’s just instantly teleporting from position to position.

Static Colliders won’t ever contact other Static Colliders because why would they, they should never move. If your Player and Enemy had a Rigidbody2D (by default Dynamic body-type) then they’d contact each other (and the platforms) so your “OnCollisionEnter2D” code would be called. Note that your Destroy code is the same as “Destroy(gameObject)” because “Collision2D.gameObject” is the GameObject the script is on.

I’m not going to try to tutorial you up here because there are lots and lots of 2D physics tutorials out there but the rule above is the important part.