- Home /
Question by
sinkler747 · Oct 27, 2013 at 03:52 PM ·
componentenable
disable a component that script is attached too
I'm try to disable a collider in script , then re-enable it later. I have tried many different ways, but none appears to be working. I know it is a simple solution, but the method escapes my mind. this is 2 of them that I thought would work, but..... also i am using JS, but I can and know how to convert.
Component.Body.enable = false;
Component.Body.CapsuleCollider.enable= false;
Comment
Answer by Zamaroth · Oct 27, 2013 at 08:49 PM
collider.enabled = false;
is what you´re looking for.
collider is a shortened version of GetComponent(CapsuleCollider) used to access the objects Collider component.
Your answer
![](https://koobas.hobune.stream/wayback/20220613120725im_/https://answers.unity.com/themes/thub/images/avi.jpg)