Any way to read editor's Physic2D "Layer Collision Matrix" in script?

Hi,

I basically want to read this:

alt text

in script.

Thanks

Well, just use Physics.GetIgnoreLayerCollision to check the values set in the matrix and use Physics.IgnoreLayerCollision to set a value for two geven layers.

I’m not sure in which Unity version those two methods got added, but in the past it wasn’t possible at all to access or change that information.

VERY IMPORTANT! There are 2 collision matrices, one for Physics, and one for Physics2D. To read Physics2D’s collision matrix, use Physics2D.GetIgnoreLayerCollision, not Physics.GetIgnoreLayerCollision.