- Home /
Firing OnTriggerEnter in the parent from a child without a script
Is there a way to either register for a child's ontrigger event or set it up so a parent gets the OnTriggerEnter fired?
I have a parent Go that has a script attached which has a script with
void OnTriggerEnter(Collider other)
{
Debug.Log("test");
}
It has a child gameobject with a box collider with the Is Trigger checked.
The event is not fired.
If I had the script to the child it fires.
This is the basis for a much larger/complex setup that I would like to create but depends on this type of functionality. Do I have to have basic scripts on the children that call the parent to tell it about the event?
try GameObject.GetComponentsInChildren(something)
you can have on trigger on child and parent can check if trigger is activated
Answer by vbbartlett · Dec 13, 2012 at 05:29 PM
Looks like I found an answer In the Forums for Compound Colliders
But for someone else that may come across this problem, I needed to add a RigidBody to the parent, (making it Kinematic) But then it seems that all child colliders pass their calls to it.
I have the exact same problem but the solution doesn't seem to work for me :( Is it because I'm working on 2D?
It doesn't work for me either. I'm using Unity 5.3.0, and neither trigger, nor non-kinematic parent makes the script be called. Any help?