Enable script from other component.

I been searching but i havent figured out how it works yet. So i want to know if you can enable a script with a script thats assigned to another object.

I have a button and i want i want, is that when i press this button it’s going to disable two scripts on another gameobject.

I know you can use. GetComponent(Script).enabled = false/true;

But i only think it works if the scipt you are trying to enable is a child of the parent where the script is on.

21085-script.png

Of course, you can.

First you need a reference to the GameObject you want to disable the script, then call GetComponent on it just like you already do.

var gameObject : GameObject;

function OnMouseUp(){

  ...
  gameObject.GetComponent(MyScript).enabled = false;

}