It’s generally a bad idea to have more than one instance of a script attached to the same GO. Are you using the trigger to switch back and forth between different settings? In this case, it might be a good idea to build that functionality into the SmoothLookAt script.
They are not in the same object, its one script attached to two different objects.
var otherscript:GameObject;
var otherscript1:GameObject;
function OnTriggerEnter () {
otherScript = GetComponent(SmoothLookAt);
otherScript.active=true;
otherScript1 = GetComponent(SmoothLookAt);
otherScript1.active=true;
}
function OnTriggerExit () {
otherScript = GetComponent(SmoothLookAt);
otherScript.active=false;
otherScript1 = GetComponent(SmoothLookAt);
otherScript1.active=false;
}
GetComponent get the component of some object, if you use GetComponent alone, it will search in the object this script is attached to.
On the other hand, GetComponent returns a Component, base clase for all components (including SmoothLookAt) and your variables are declared as GameObject.
You should have something like this to (de)activate components
var object : GameObject; // setted in the inspector to be the object in which lays the component to be (de)activated
private var script : ComponentName;
function Awake ()
{
script = object.GetComponent (ComponentName); // cache the component
}
function OnTriggerEnter ()
{
script.enabled = true;
}
function OnTriggerExit ()
{
script.enabled = false;
}