Just some basic troubleshooting: if you place a Debug.Log call above your condition, does that execute? This tells whether the problem lies in the collision or in the subsequent name comparison.
Did you see this part of the manual?
“Note: Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached. Collision events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.”
Also, checking with a name like that is no good, super prone to error and very limited.
My suggestion to you is to use tags.
You are using OnCollisionEnter instead of OnTriggerEnter. I think it’s the problem, and you are also comparing with game object name, and you should use tags instead. Try something like this:
void OnTriggerEnter(Collider other)
{
if (other.tag == "Ennemies") // I have used the same tag that you attached to your enemy character
{
Debug.Log("has collide");
currentHealth -= 5;
healthBar.value = CalculateHealth();
}
}
Hope it helps you.
Remember to set one of the colliders as IsTrigger