Renderer enable

Hey! I am trying to make an amount of gameobjects render when a boolean is true. Here is my code:

if(buyTowerMenuUp == true){
	towerPlace[] = GameObject.FindGameObjectsWithTag("TowerPlace");
	
	for(var x = 0; x < towerPlace.length; x++){
		towerPlace[x].renderer.enabled;
	}


}

Thanks in advance!

1. You didn't include a question. 2. try ...renderer.enabled = true;

try towerPlace[x].renderer.enabled = true;

It says that I have to insert a semicolon at the towerPlace[] = GameObject.FindGameObjectsWithTag("TowerPlace"); line

And thanks, that helped aswell :)

1 Answer

1

I could be incorrect but i looks like your assignment is incorrect.

towerPlace[] = GameObject.FindGameObjectsWithTag("TowerPlace");

should be

var gos : GameObject[] = GameObject.FindGameObjectsWithTag("Enemy");

It worked! The towerPlace was a gameobject so that was probably the error aswell as putting the field[] at the variabel instead of after GameObject. Thanks alot!