count the number of gameobject using tag code example
Example: how to find the number of objects with the same tag in unity
if(GameObject.FindGameObjectsWithTag("Enemy").Length > 20) { // Do something }
if(GameObject.FindGameObjectsWithTag("Enemy").Length > 20) { // Do something }