• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by vbbartlett · Dec 13, 2012 at 03:57 AM · ontriggerenterparentchildevent

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?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image shane.rachel · Dec 13, 2012 at 05:33 AM 0
Share

try GameObject.GetComponentsInChildren(something)

you can have on trigger on child and parent can check if trigger is activated

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

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.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image drHogan · Apr 02, 2014 at 05:04 PM 0
Share

you saved my day ;)

avatar image justkedin · Jun 20, 2014 at 11:15 AM 1
Share

I have the exact same problem but the solution doesn't seem to work for me :( Is it because I'm working on 2D?

avatar image Harinezumi justkedin · Feb 04, 2016 at 10:39 PM 0
Share

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?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Make a simple tree 1 Answer

OnTriggerEnter - check if collider is child 1 Answer

How to Instantiate Prefab as Child of Player OnTriggerEnter 0 Answers

Parenting On Trigger not Working? 3 Answers

2 objects, same script, OnTriggerEnter individually 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges