Help with booleans (Java)

Hello Guys,
I want to enable all functions in my Java script, when the boolean is enabled.
The boolean get’s enabled trough an other Script via GetComponent.

Please help :slight_smile: sry for my bad english (Germany :smile:)

//assuming you already have
function MyWonderfulFunction(){
   // my code here
}

//you would either do (for each function you want affected by the boolean)

function MyWonderfulFunction(){
   if(myBoolean == false){ //or if(!myBoolean)
      return; // exit this function if boolean is false
   }

   // my code here
}

// or

function MyWonderfulFunction(){
   if(myBoolean){  // do my code if boolean is true
       // my code here
   }
}

sorry for my bad psuedo code… I like C#

Thank you :slight_smile:

var doFunction : boolean;

function Update () {
     if (doFunction) {
             MyFunction ();
      }
}

function MyFunction () {
     //code here
}