Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Collisions / Collision Detection Matrix / Nested GameObjects query

Discussion in 'Editor & General Support' started by Rob-Meade, Feb 28, 2019.

  1. Rob-Meade


    Oct 27, 2016

    I have a parent GameObject which contains multiple child GameObjects. All of the children are on one layer, the parent is set to another.

    When I run the game, projectiles from the player should only be able to be detected by the child GameObjects, however the parent GameObject is currently receiving these messages also, regardless of the settings in the Collision Detection Matrix.

    I have checked the GameObjects and prefabs in question and the layers are set correctly, the Collision Detection Matrix is also set correctly.

    The only way I seem to be able to prevent the parent GameObject from receiving the message is to disable, in the Collision Detection Matrix, the layer being used by the child GameObject, if I do this, no message is sent to the parent either. But, if it's enabled, the parent GameObject also receives the message.

    Any thoughts as to why I would receive messages for the collision in the parent object, is this message being bubbled up in some way?

    Whilst I can add some logic in the OnTriggerEnter2D method to effectively ignore it, I'd have liked the Collision Detection Matrix to have ignored it instead.