how do i enable and disable specific components on a gameobject with a script?
asked Sep 07 '10 at 10:03 PM
In order to be able to "disable" something, it generally must derive from Behaviour. (Renderer is a notable exception). If you see a checkbox in the Inspector, you can enable or disable it. There are a bunch of shortcuts. For those that have a checkbox, you can do it like this:
For other behaviours, like your own scripts, you can do it like this, in UnityScript:
or in C#:
answered Sep 07 '10 at 10:49 PM