- Home /
Toggle Mesh colliders Rigidbodies and Materials in realtime
well i am looking to toggle mesh colliders rigidbodies and materials in realtime. I have just about everything down besides a way to toggle them correctly. i'm using this to get a rolling level loading effect where one level will load and one level will unload during an animation (i.e. toggle materials colliders and any rigidbodies). i would prefer an answer that didn't require unity pro but i'm willing to take anything.
Answer by syclamoth · Nov 06, 2011 at 11:49 PM
Well, each of those things has a boolean value which can be set to either true or false to have them either turned on, or turned off.
Colliders use
collider.enabled = trueOrFalse;
Rigidbodies use
rigidbody.isKinematic = trueOrFalse;
(kinematic rigidbodies will still act like static colliders, so make sure you turn off the collider at the same time)
Materials use
renderer.enabled = trueOrFalse;
Just out of interest, is there any reason you aren't just deleting things and using LoadLevelAdditively?
Answer by jpeg · Nov 07, 2011 at 12:15 AM
thanks for the answer it worked out great! also i didn't even know that i could load a level additively, another question with that can it unload a level once its been loaded?
Your answer
![](https://koobas.hobune.stream/wayback/20220613033733im_/https://answers.unity.com/themes/thub/images/avi.jpg)