Tags, Layers and Scene Constants Generator in Unity

March 11, 2014 by Devin Reimer

For those that hate manually typing strings for comparing because it’s error prone, lacks auto-complete and is sometimes¬†difficult to change. I’ve updated my previously available tags and layers constants generator to also support scenes!

With this script simply go ‘Edit->Rebuild Tags, Layers and Scenes Classes’. It then auto generates updated versions of the classes (Tags.cs, Layers.cs & Scenes.cs) and puts them in Scripts/AutoGenerated folder. To use, simply type the constants, ex: Tags.RESPAWN, Layers.IGNORE_RAYCAST or Scenes.GAME.

No more hard-coded strings!

Download TagsLayersScenesBuilder.cs (right-click save as).

Remember to put it in a folder called ‘Editor’ in your project.