- Home /
Question by
Prog_Meisters · Dec 15, 2015 at 09:26 PM ·
collidercollidersontriggerenter
OnTriggerEnter is triggering from colliders on child objects
I have an enemy game object. It has the parent object with a capsule collider to detect if something comes in weapon range and I have a child object with another much larger collider to act as a sight radius. The problem comes up with something enters the child's collider and the script attached to the parent triggers as if its collider was entered. Will OnTriggerEnter always detect collisions on all child objects?
Here is the code I have for the parent.
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Unit")
{
meleeTargets.Add(other.gameObject);
inMelee = true;
}
}
Comment
Your answer
Follow this Question
Related Questions
How Does OnTriggerEnter() Work? 0 Answers
Make object react to certain triggers only 1 Answer
one collider for 2 combined object 2 Answers
How to use different and distinguish between different box colliders? 1 Answer
OnTriggerEnter does not work 1 Answer