Use IgnoreCollision and IgnoreLayerCollision together?


Is it possible to use these two together? I’m setting my two objects to two different layers and use IgnoreLayerCollision so they don’t collide with each other but under some circumstance I want one or two of those to collide with the other layer again.

I tried it but it didn’t work so I may be missing something.

What I did is what I described and then when one of them enters a trigger, I put IgnoreCollision with that object and some colliders that are in layer that is in that IgnoreLayerCollision but it seems IgnoreLayerCollision has a higher priority.

Am I missing or it’s the way things are in Unity?

I basically want to ignore that Layer with IgnoreCollision.


just use a 3rd layer. :stuck_out_tongue:

layer 3 is the SOMETIMES layer. It includes both objects from the different layers and is used as the collision layer in the event you want them to collide.


object A is part of layer A and Layer C
object B is part of layer B and Layer C

Layer C is used as the collision layer when you want collisions between them.

Mark as answered and have a nice day. :slight_smile: