- Home /
Any way to read editor's Physic2D "Layer Collision Matrix" in script?
Hi,
I basically want to read this:

in script.
Thanks
Answer by Bunny83 · Oct 06, 2014 at 01:33 PM
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.
Answer by UnityDeveloper2 · Mar 24, 2018 at 12:16 AM
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.
As far as i remember in the past there was only one but they splitted it up since they are essentially complete seperate systems. Though it's unlikely that you actually will need 2d and 3d physics at the same time.
Anyways of course you're right.
Your answer
Follow this Question
Related Questions
Set MinWidth for EditorWindow 1 Answer
iOS game: Physics with ConstantForce 1 Answer
Why my Roguelike 2D graphics are naughty in devices? 1 Answer
Left Click Up Event in Editor 4 Answers
EditorWindow texture effected by Playmode Color Tint 1 Answer