enable disable variable of a script from another script

how can I enable or disable a variable in a script attached to a gameobject from another script?

here is my code

var mouseON=true;

var characterON=true;

function Update () {




and to enable I use


how can I can change the value of mouseON only?

i try


but don’t work

Create two fields: player_mouse_look and player_character_motor.

In the Start() function (not Update() ) do the following:

player_mouse_look = GameObject.Find("Player").GetComponent("MouseLook");
player_character_motor = GameObject.Find("Player").GetComponent("CharacterMotor");

These two lines mean that you look for the components you need once, and store the information on where they are so you don’t have to look for them every frame. You won’t need the code in the Update() function anymore. Instead, whenever you want to enable mouselook, just do this:

player_mouse_look.enabled = true;

Same thing for player_character_motor.

You might want to check if the two variables you created are not null. It should only happen when a component is missing, though.

Also, if the components you use change during the game for any reason, you’re going to need to update the variables whenever that happens.

but this was just an example,
I would like to understand how I can turn on a variable of a script from another script.

var Player : GameObject; //Drag your Player in here

function Update (){

function Start () {
Player.GetComponent(“MouseLook”).enabled = true;

Maybe this is what you are looking for:

var mouseON : boolean = true;

var characterON : boolean = true;

function Start () {
var Player : GameObject.Find(“Player”);
if(Player.GetComponent(“MouseLook”).enabled == true){
mouseON = false;
if(Player.GetComponent(“EnablePlayer”).enabled == true){
//charakterON = false;
//charakterON = true;