How to check if any object has a certain tag

so what i trying to do is making buttons randomly generate in specific places. but i need a way to check if no buttons spawned. so that way I can spawn one through script.

To answer your question (out of curiosity), use this when looking for a tag on a single/specific GameObject:

// check if the GameObject has a certain tag
if ( TheNameOfYourGameObject.tag == "PlaceTagHere" )
{
	
}

If you want to check if there are any GameObjects with a specific tag, you could do this:

public var array : Array;// create an array
array = GameObject.FindGameObjectsWithTag ( "PlaceTagHere" );// set the array to hold all GameObjects with the specified tag

// check if there are any GameObjects (with the specified tag) spawned
if ( array.length == 0 )
{
	// There are no buttons, begin spawning buttons...
}

I feel like your question isn’t clear enough. Do you have any script, like the one that’s generating the buttons? You could make a while loop like for example.

while (ButtonsSpawned == 0){


//the script you use to spawn buttons


}

Though your question is still vague, I hope this might help.

yup that worked Thanks for the answer!!