I am working on a 2D game and everything seems to be going great except for the health-bar. it works perfectly but it does not detect collisions in the objects. it goes something like this.
function OnCollisionEnter2D(coll: Collision2D) {
if (coll.gameObject.tag == “Enemy” && Sheild.active == false){
isHurtin = true;
}
}
it detects collisions with enemies, but it only works with colliders in the Player not any of its children. how could I fix my little problem?