Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

OnTriggerEnter only called on one gameObject

Discussion in 'Editor & General Support' started by JosephSelahJr, May 27, 2022.

  1. JosephSelahJr

    JosephSelahJr

    Joined:
    Oct 1, 2020
    Posts:
    18
    I'm not sure if this is expected or not. But I have a collider on two gameObjects, I have a rigidBody on one and IsTrigger set to true on the other. What I was expected was for OnTriggerEnter to be called on both gameObjects but it's only being called on one. I even added OnCollissionEnter as a test and same result. One gameObject just receives no events at all.

    Is this expected? Or have I just set something up incorrectly. I'd prefer for each gameObject to be responsible for it's own work.
     
  2. JosephSelahJr

    JosephSelahJr

    Joined:
    Oct 1, 2020
    Posts:
    18
    I should mention that the gameObject that's not receiving any events is buried pretty deep inside of a prefab. I'm not sure if that matters. Stated just for completeness.
     
  3. JosephSelahJr

    JosephSelahJr

    Joined:
    Oct 1, 2020
    Posts:
    18
    I just realized I can post pics. This should help explain my set up.
    upload_2022-5-27_2-1-21.png
    upload_2022-5-27_2-2-10.png
     
  4. JosephSelahJr

    JosephSelahJr

    Joined:
    Oct 1, 2020
    Posts:
    18
    I had to add a rigidbody to both colliders which seemed odd. I read that it's only needed on one but either way, it's resolved.
     
    Kurt-Dekker likes this.