Void can not be used with bool?

I am making a script and the function I am using is function Update()

 and it keeps coming up with Void cannot be used with Bool. I am not using void so please help.

Section of my code that is having problem

    if(Input.GetKey("p") && keyMenu.gameObject.SetActive(false)){
    	
    	 keyMenu.gameObject.SetActive (true);
    	
    	}

The SetActive method has a return value of void. However, you are using as part of the if() conditions, where each condition has to be of type bool. In other words you can’t use the following inside the if() conditions:

keyMenu.gameObject.SetActive(false)

Instead, you should use either of these, depending on what you want to do:

keyMenu.gameObject.activeInHierarchy

//OR

keyMenu.gameObject.activeSelf

You use keyMenu.gameObject.SetActive(false) expression (which has a void type) where a boolean expression is expected. You either misunderstood what the SetActive() method is for, or tried combining its usage as both setting and reading the value, which is not recommended and neither works. In case of the first you need to replace SetActive() with activeSelf or activeInHierarchy. Which one depends on your needs. In case of the second first set the value and then read it. Although after setting it it’s kind of obvious what’s gonna be read.

Java script

#pragma strict

 var Green: Transform;
 var Red: Transform;
 var Blue: Transform;
 var bigBlue: Transform;
 var bigGreen: Transform;
 var bigRed: Transform;
 var Pink: Transform;
 var Yellow: Transform;
 var Cyan: Transform;
 var White: Transform;
 var keyMenu: Transform;


function Start () {

 	 Green.gameObject.SetActive (false);
 	 Red.gameObject.SetActive (false);
 	 Blue.gameObject.SetActive (false);
 	 bigBlue.gameObject.SetActive (false);
 	 bigRed.gameObject.SetActive (false);
 	 bigGreen.gameObject.SetActive (false);
 	 Yellow.gameObject.SetActive (false);
 	 Pink.gameObject.SetActive (false);
 	 Cyan.gameObject.SetActive (false);
 	 White.gameObject.SetActive (false);
 	 keyMenu.gameObject.SetActive (true);

}

function Update () {

	if(Input.GetKeyDown("a")){
	
	 Green.gameObject.SetActive (true);
	
	}

	
	if(Input.GetKeyDown("s")){
	
 	 Red.gameObject.SetActive (true);
	
	}
	
	if(Input.GetKeyDown("d")){
	
 	 Blue.gameObject.SetActive (true);
	
	}
	
	
	if(Input.GetKeyDown("f")){
	
 	 bigBlue.gameObject.SetActive (true);
	
	}
	
	if(Input.GetKeyDown("g")){
	
	 
 	 bigRed.gameObject.SetActive (true);
 	 
	
	}
	
	if(Input.GetKeyDown("h")){
	
	 bigGreen.gameObject.SetActive (true);

	
	}
	
	if(Input.GetKeyDown("j")){
	
	 Pink.gameObject.SetActive (true);
	
	}
	if(Input.GetKeyDown("k")){
	
	 Yellow.gameObject.SetActive (true);
	
	}
	if(Input.GetKeyDown("l")){
	
	 Cyan.gameObject.SetActive (true);
	
	}
	if(Input.GetKeyDown(";")){
	
	 White.gameObject.SetActive (true);
	
	}

	if(Input.GetKeyUp("a")){
	
	 Green.gameObject.SetActive (false);
	
	}
	
	if(Input.GetKeyUp("s")){
	
		Red.gameObject.SetActive(false);
	
	}
	if(Input.GetKeyUp("d")){
	
	 Blue.gameObject.SetActive (false);
	
	}
	
	if(Input.GetKeyUp("h")){
	
	 bigGreen.gameObject.SetActive (false);
	
	}
	
	if(Input.GetKeyUp("g")){
	
	 bigRed.gameObject.SetActive (false);
	
	}
	
	if(Input.GetKeyUp("f")){
	
	 bigBlue.gameObject.SetActive (false);
	
	}
	if(Input.GetKeyUp("j")){
	
	 Pink.gameObject.SetActive (false);
	
	}
	if(Input.GetKeyUp("k")){
	
	 Yellow.gameObject.SetActive (false);
	
	}
	if(Input.GetKeyUp("l")){
	
	 Cyan.gameObject.SetActive (false);
	
	}
	if(Input.GetKeyUp(";")){
	
	 White.gameObject.SetActive (false);
	
	}
	
	if(Input.GetKey("p") && keyMenu.gameObject.SetActive(true)){
	
	 keyMenu.gameObject.SetActive (false);
	
	}
	
	if(Input.GetKey("p") && keyMenu.gameObject.SetActive(false)){
	
	 keyMenu.gameObject.SetActive (true);
	
	}

	

}