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...
}
↧