Blog

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.

5 Responses to "Tags, Layers and Scene Constants Generator in Unity"

  1. Erian says:

    Hi, thanks so much for this. I was just about to try to create this myself but just stumbled across your blog, and it works wonderfully. By the way when adding scenes you can check for scenes in the current build from a variable attached to EditorBuildSettingsScene (“enabled”) you probably already knew this but I thought I would put it out there.

    Oh and really enjoying the blog I have learned a thing or two from this site.

    Thanks Erian.

  2. WalterMub says:

    Сервисный ремонт стиральных, вы можете позвонив по тел.: 8 (925) 205-98-25, либо пройти по ссылке ниже…

    ремонт стиральных машин lg сервисный центр

  3. Blenderphz says:

    manuscripts underwent in the Middle

  4. Jeff says:

    Thanks for this. Works perfectly and saved me some time.

Leave a response