Unity2d trying to make an enemy react to an attack with a flash. Why isn't this code working?

My first problem is getting this enemy to react. I’m sure I’ve gotta be doing something simple wrong. The if statement in the oncollision2d method is never being called. The information in that if statement isn’t being printed.

The name of the asset that collides with the enemy is AttackSpellPrefab. There’s a separate attack script that handles instantiating the attack and sending it along a path. in the hierarchy, when the attack instantiates, an item called AttackSpellPrefab(Clone) is created. Is that the correct name to reference in the above mentioned if statement? that script is attached to the player. the attack spell prefab is then dragged into a slot for a rigidbody2d on the player.

If it makes a difference on where I need to write the script, I would like to be able to switch between different attacks, so I think I would need to create a “spellbook” object that holds the master list of abilities (or just two to get the code going) and reference it from there, with the game manager script checking to see which spells the player has access to. when the player switches attacks, an object (the spellbook object?) should assign the correct image and rigidbody and collider to the player.

I can provide all of my code if you need more than just this class’s code to help.

using UnityEngine;
using System.Collections;

public class EnemyScript : MonoBehaviour {

    Rigidbody2D myBody;
    [SerializeField]
    float hitPoints = 10; //tweakable number of hit points to initialize with
    float currentHitPoints; //HP number to work with in script
    Transform myTransform;
    //[SerializeField]
  //  Sprite splatSprite; //sprite to indicate death
   // [SerializeField]
    //Sprite liveSprite; //sprite to indicate not dead.
    SpriteRenderer mySprite;


    // Use this for initialization
    void Start() {

        myBody = GetComponent<Rigidbody2D>();
        currentHitPoints = hitPoints;

    }

   
    public void OnCollisionEnter2d(Collision2D other)
    {
        if (other.transform.name == "AttackSpellPrefab(Clone)")
        {
                currentHitPoints--;
            FlashIt();
            print("I've been hit!");
            print(currentHitPoints);

        }
    }
    IEnumerator FlashIt()
    {
        GetComponent<SpriteRenderer>().enabled = false;
        yield return new WaitForSeconds(.5f);
        GetComponent<SpriteRenderer>().enabled = true;
    }

    public void HealthCheck()
    {
        if (currentHitPoints < 1)
        {
            //   mySprite.sprite = splatsprite
            print("I Die");
        }
    }

        // Update is called once per frame
        void Update () {
        HealthCheck();
        }
    }

To resolve my main issue i used a second hitbox and made it a trigger with no material, then used ontrigger instead of oncollision. I also assigned a tag to the attack and use the tag to identify the gameobject. It now calls the if statement, checks if it’s an attack, and reduces the enemies health, prints the enemies health, declares it has been hit.

I’m now working on getting

    IEnumerator FlashIt()
         {
             GetComponent<SpriteRenderer>().enabled = false;
             yield return new WaitForSeconds(.5f);
             GetComponent<SpriteRenderer>().enabled = true;
         }

to work by calling FlashIt(); in the if statement in the ontriggerenter2d method.