I’ve been trying to use IgnoreLayerCollision to disable collisions between two different sets of objects within my game but run into a problem where it simply doesn’t disable the physics with hit response and detection still occurring.
Debug.Log(LayerMask.NameToLayer("projectiles")); // prints 9
Debug.Log(LayerMask.NameToLayer("Avoid projectiles")); // prints 10
Physics.IgnoreLayerCollision(9, 10, true);
Physics.IgnoreLayerCollision(10, 9, true);
Physics.IgnoreLayerCollision(9, 9, true);
Physics.IgnoreLayerCollision(10, 10, true);
I have tested to make sure i have the correct layers and additionally checked with the Physics defaults and which is set up as expected.
The objects are all on the right layer as i expect so not totally sure what is going wrong. I am working within a 2D world set up if that affects this.
Thanks in advance