NullReferenceException OnMouseUp gameObject.SetActive

Hi,
i made a working menu script and now i tried to add a “gameObject.SetActive(true);” but since i added that line the Console always says

'NullReferenceException
MainMenu.OnMouseUp () (at Assets/Scripts/MainMenu.js:34)
UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32, Int32)

Here’s my code:


var isQuit=false;

var isPlay=false;

var isProfile=false;

var isLinks=false;

var isRechts=false;

var isWeiterRechts=false;

var isWeiterLinks=false;

var serverscreen = false;

function OnMouseEnter(){
renderer.material.color=Color.yellow;
}

function OnMouseExit(){
renderer.material.color=Color.white;
}

function OnMouseUp(){

if (isQuit==true) {
Application.Quit();
}

else {

if(isPlay){

serverscreen = true;

GameObject.Find(“MainCamera”).animation.Play(“Uebergang02”);

GameObject.Find(“MenuHolder”).gameObject.SetActive(true);

}else{

if(isProfile){
GameObject.Find(“MainCamera”).animation.Play(“Uebergang”);

}else{

if(isLinks){
GameObject.Find(“MainCamera”).animation.Play(“Links”);

}else{

if(isRechts){
GameObject.Find(“MainCamera”).animation.Play(“Rechts”);

}else{

if(isWeiterLinks){
GameObject.Find(“MainCamera”).animation.Play(“WeiterLinks”);

}else{

if(isWeiterRechts){
GameObject.Find(“MainCamera”).animation.Play(“WeiterRechts”);

}else{
Debug.Log(“keine Bedingung erfüllt”);
}
}
}
}
}
}
}
}

function Update(){

}

I think you need to do something like

GameObject temp = GameObject.Find("MenuHolder"); //possibly GameObject.FindGameObjectWithTag("MenuHolder");
temp.SetActive(true);

gameObject.SetActiveRecursively(true);