How to add certain GameObjects with Booleans to an Array

I’m trying to add all GameObjects with a certain tag and boolean enabled.

Adding the tags was easy:
Check = GameObject.FindGameObjectsWithTag(“Target”);

But it seems that I can’t check GetComponent and then the boolean while setting up the array.

Any suggestions?

Assuming you know how to get the array of GameObjects with a given tag, here is some code that will iterate over an array of GameObjects and assign the ones that are enabled to another array named activeThings.

To use this example you would set allThings equal to your array of GameObjects with a certain tag.

It demonstrates how you can build a Builtin array using a javascript dynamic array temporarily.

var allThings     :  GameObject [];

var activeThings  :  GameObject [];    

function Start ()
{
	var tempArray : Array = new Array();

	for ( var thisThing : GameObject in allThings ) {
		if ( thisThing.transform.renderer.enabled ) {
			tempArray.Push(thisThing);			
		}
	}

	activeThings = tempArray.ToBuiltin(GameObject);
}