Send message to parent.

So, a player has sword, that sword’s child has a trigger collider, the sword has a script which has a function ontriggerenter that applies damage to the collider that it hit. There is an rigidbody enemy that has a child, that child has a collider.

2 Problems :

  1. Sword script never gets activated because the object sword doesn’t have a collider, it’s child does.
  2. Lets say i fixed the first problem. If sword hits enemy, it doesn’t send the apply damage function to the enemy, but the enemies child, which has a collider.

Is there a way to fix these problems without putting colliders on parents, is there some script that sends the damage to the parent, not the child?

Solved the second problem by using the function GameObject.SendMessageUpwards to send the message to the collider’s parent.