I use a SendMessage function for my melee attack, but it doesn’t work


I have a melee attack script that work like a charm for the other enemy. But for this one enemy, it doesn’t work. This is the script for the melee attack which utilises the SendMessage function. You can see that there is a Debug.Log statement whenever my player hits something. For the enemy that doesn’t work, when in game, the message is sent, but the effect doesn’t happen.Weirdly enough, the particles instantiate, but the enemy health doesn’t work. This is the melee attack script (only the SendMessage function)

    private void CheckAttackHitBox()     {         Collider2D[] detectedObjects = Physics2D.OverlapCircleAll(attackHitBoxPos.position, attack1Radius, whatIsDamageable);          attackDetails[0] = attack1Damage;         attackDetails[1] = transform.position.x;          foreach (Collider2D collider in detectedObjects)         {             collider.transform.parent.SendMessage("Damage", attackDetails);             Debug.Log("MessageSent");         }     } 

This is my enemy script that receives the message:

private void Damage(float[] attackDetails)     {         currentHealth -= attackDetails[0];          Instantiate(hitParticle, transform.position, Quaternion.Euler(0.0f, 0.0f, Random.Range(0.0f, 360.0f)));          //the x position of the player is greater than the x position of the enemy         if (attackDetails[1] > transform.position.x)         {             damageDirection = -1;         }         else         {             damageDirection = 1;         }          if (currentHealth <= 0.0f)         {             Die();         }     } ```