- Home /
define physics collision layers and set them dynamically
I want to set collision layers for an object dynamically. I have a main game object with a collider that surrounds many different interior objects with colliders.
I'd like to put the outer gameObject in layer 8 and the inner parts in a layer 9
Is there a way to set the layers dynamically so I can use Physics.IgnoreLayerCollision(8,9,true)
The posts I've seen talk about setting layers with a manager not a script. I opened up physics inspector and I see these layers (default, transparent,ignore raycast,water) In the tag manager I see layer and add layer but in unity4 it doesn't seem to let me add a layer, for example I can click on user 8 but nothing happens.
I'd like to add two layers 8 and 9 and then put inner in 8 and outer in 9 but set the layers in the script. Does anyone know how to add the layers and then set them from a script?
Your answer
![](https://koobas.hobune.stream/wayback/20220613085803im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
2D 360 degress platformer example needed 0 Answers
Re enable Physics between Objects 1 Answer
How to reactivate a gameObject? 3 Answers
Time.timescale cause extreme lag? 1 Answer
Faux Gravity Prolem? #2 2 Answers