Last active
September 26, 2024 09:02
-
-
Save Namek/ecafa24a6ae3d730baf1 to your computer and use it in GitHub Desktop.
Tags and Layers Enums Builder for Unity3D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This class is auto-generated, do not modify (use Tools/TagsLayersEnumBuilder) | |
public abstract class Layers { | |
public const string Default = "Default"; | |
public const string TransparentFX = "TransparentFX"; | |
public const string IgnoreRaycast = "Ignore Raycast"; | |
public const string Water = "Water"; | |
public const string UI = "UI"; | |
public const string Camera = "Camera"; | |
public const string Characters = "Characters"; | |
public const string Floor = "Floor"; | |
public const string Sprites = "Sprites"; | |
public const string Terrain = "Terrain"; | |
public const string Squads = "Squads"; | |
public const string Selectable = "Selectable"; | |
public const string Obstacles = "Obstacles"; | |
public const int DefaultMask = 1; | |
public const int TransparentFXMask = 1 << 1; | |
public const int IgnoreRaycastMask = 1 << 2; | |
public const int WaterMask = 1 << 4; | |
public const int UIMask = 1 << 5; | |
public const int CameraMask = 1 << 8; | |
public const int CharactersMask = 1 << 9; | |
public const int FloorMask = 1 << 10; | |
public const int SpritesMask = 1 << 11; | |
public const int TerrainMask = 1 << 12; | |
public const int SquadsMask = 1 << 13; | |
public const int SelectableMask = 1 << 14; | |
public const int ObstaclesMask = 1 << 15; | |
public const int DefaultNumber = 0; | |
public const int TransparentFXNumber = 1; | |
public const int IgnoreRaycastNumber = 2; | |
public const int WaterNumber = 4; | |
public const int UINumber = 5; | |
public const int CameraNumber = 8; | |
public const int CharactersNumber = 9; | |
public const int FloorNumber = 10; | |
public const int SpritesNumber = 11; | |
public const int TerrainNumber = 12; | |
public const int SquadsNumber = 13; | |
public const int SelectableNumber = 14; | |
public const int ObstaclesNumber = 15; | |
} |
I use this instead and just manually update it.
using System;
namespace Legend
{
public static class Layer
{
public const int Default = 1;
public const int TransparentFX = 1 << 1;
public const int IgnoreRaycast = 1 << 2;
public const int UserLayer3 = 1 << 3;
public const int Water = 1 << 4;
public const int UI = 1 << 5;
public const int UserLayer6 = 1 << 6;
public const int UserLayer7 = 1 << 7;
public const int Ground = 1 << 8;
public const int Projectile = 1 << 9;
public const int Enemy = 1 << 10;
public const int Player = 1 << 11;
public const int BlocksPlayerMovement = 1 << 12;
public const int Pickup = 1 << 13;
public const int EnemyProjectile = 1 << 14;
public const int ProjectileIgnored = 1 << 15;
public const int FlyingPlayer = 1 << 16;
public const int Debris = 1 << 17;
public const int Walls = 1 << 18;
public const int PlayerInvulnerable = 1 << 19;
public const int Animal = 1 << 20;
public const int Zones = 1 << 21;
public const int Environment = 1 << 22;
public const int NoSpawn = 1 << 23;
public const int NPC = 1 << 24;
public const int Building = 1 << 25;
public const int UserLayer26 = 1 << 26;
public const int UserLayer27 = 1 << 27;
public const int UserLayer28 = 1 << 28;
public const int UserLayer29 = 1 << 29;
public const int Item = 1 << 30;
public const int UserLayer31 = 1 << 31;
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fantastic work!!! Thx, It's what I need right now.
When I use it, some problem occured when some layer names started whith numeric character like "2DLayer". And I do some fixes for it.
Here it is:
Add a static method
Use the method above after get field name:
here:
and here (in method of rebuildTagsFile):
sb.Append("\tpublic const string " + CheckStartWithNumberic(tagName + " = "" + tagName + "";\n"));
Done
Another problem: the path of "enumsPath" isn't exist
add a check and create it
All above.
Thank you for all your working~~
Best wishes
yours