Creating tags via code

Is it possible to create tags via a script rather than creating them manually?

basically i have over 20 enemies

adding the tag looks like this

private GameObject[] enemies;

void Start ()
{
	enemies = GameObject.FindGameObjectsWithTag ("Enemy");

	for ( int i=0; i<enemies.Length; i++ ){
	enemies*.tag = "enemy" + (i+1).ToString() ;*
  •   }	*
    
  • }*
    would be great if i could create tags as and when needed

Tags can only be created in the editor.

Tags are usually used to group similar objects or to identify (tag) it as part of that group. If every object should have it's own tag, i don't see why you not just use the name instead of a tag... You know that there's GameObject.Find which can be used to search for the gameobject's name.

The name can be changed to anything you like.

You can also try something like this with a customeditor: