can't detect what player collides with, tried everything and all other posts...

so i want to make a 2d game where when player collides with spike it triggers something (for now i want debug.log to trigger just to be sure)

void OnCollisionEnter2D(Collision2D trig)
{
    if (trig.gameObject.tag == "Enemy")
    {
        Debug.Log("player touches enemy");
    }

well if it shows the code bad sorry.
so, i am trying to detect the tag of the Enemy (spike) and make a trigger.

after that i will put a die script.

edit:

void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.tag == "Enemy")
    {
        Debug.Log("OH SHIT");
    }

from the Unity Manual works…

The spike must have a non kinematic rigidbody attached to.

Or instead of attaching the script to the player, you attach it to the spike.

  void OnCollisionEnter2D(Collision2D collision)
  {
      if (collision.gameobject.CompareTag("Player"))
      {
          Debug.Log("I am the enemy and the player touched me");
      }