Pimp Your Enums’ Elements In Unity

Enums, once you get to use them in unity once, you will always try to use them. Not only do they save confusion by avoiding having to use many boolean flags, but also help you tidy up your code and work amazingly well on the Unity inspector. If for some reason you never heard of them, do give yourself the time to research them.

Taking the latter example however, there ARE limitations when it comes to how they appear in the inspector. Essentially speaking, the way you name an enum element, is how they appear on the inspector, separated by capital letters.

i.e. MyEnumElement becomes "My Enum Element" on the dropdown.
This isn’t bad by any means, but there are sometimes when you would prefer something cleaner, like:
GreaterOrEqual to appear instead as: ">=" in the dropdown would be easier to comprehend.
This is the reason this nifty little tool exists.

Download The Tool

Once the attribute is downloaded, simply add it before an enum element AND the enum instance.

Download it for FREE!

PLEASE NOTE: That without it on the enum instance, it WON’T work. i.e.:

public enum MyEnum
   [EnumLabel("Element #1")]
   ElementTwo, // This one will appear normal ("Element Two")
   [EnumLabel("Element (2^31) - 2147483644")]

// With no attribute, this one will not work with the labels from above, they will ALL appear normally.
public MyEnum myEnumInstance;

[EnumLabel("This Is How I Appear In The Inspector Now")]
public MyEnum myOtherEnumInstance; // This one will work with the above labels, PLUS it can have a custom inspector name.

Visit The GitHub Repository For More FREE Tools

You just read about one of several FREE tools that you can get on the Unity Development Tools Repository. Again, they are FREE so just go see them, there are neat things in there~

See all of the tools!

(And yes, I’m a big fan of DDLC)
That will be all for today~

But Like Always…

Thank you very much for reading my blog :3

GDCR - Juice It Or Lose It

While working in a game, ever felt like your progress is kinda bland? That it is missing something. That something might be juice, so keep an eye on this talk. Continue reading

Software Suggestion - Hootsuite

Published on April 05, 2018

Unity Tip - Built-In Primitive Sprites

Published on April 04, 2018