Several questions about component

1.I create several script file and drag them for an object.
In the Inspector,some have a “checkbox” beside the script(MouseClick script),but some don’t(AddAids).
And How can I know which script or component will have this selection?
you can see the image this link:alt text

2.Is there some method to “enable” or “disable” my script?
Including System’s component like “HingeJoint”.
Or “add” and “remove” component?

thx…

I was puzzled about this as well, so I played around with my editor until I was able to reproduce the behavior. It has to do with a script’s Awake, Start, Update, FixedUpdate and OnGUI functions. If you disable a script from startup, none of those are called.

But if you have deleted all of those functions from the script, then setting Monobehavior.enabled from startup has no effect on whether the functions are called or not. Therefore, the checkbox isn’t displayed on scripts that lack all of these functions.

The documents state the same point here:

http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.html

I’m a little puzzled why the second script in your picture has no checkbox. As far as I know each script gets one by default.

Components that can be enabled/disabled can have that done through gameObject.scriptName.enabled = true/false;

According to the docs there is no simple way to remove a component. There is an AddComponent() but: “Note that there is no RemoveComponent(), to remove a component, use Object.Destroy.”