First, you must have a reference to the script you wish to enable/disable. You can make this a public variable and drag the gameobject using the script into the inspector:
public var scriptName : ScriptName;
This method is good to use if you know exactly what gameobject is using the script or if it's already in the scene. You then enable/disable the script like so:
scriptName.enabled = true;
scriptName.enabled = false;
Or you can grab the component from the gameobject using it:
public var scriptName : ScriptName;
public var gameobjectUsingScript : GameObject;
scriptName = gameobjectUsingScript.GetComponent( ScriptName );
then enable/disable the script like so:
scriptName.enabled = true;
scriptName.enabled = false;
↧