Enum extensions - Team-Swamp/IceBites GitHub Wiki

Overview

This is a static class that improve the usage of enum with custom attributes.

Write by - Bas

Usage

Every method it public.

Methods Return Description
GetString(Enum) string Get the string of an enum type. If not existing returns empty string
GetChar(Enum) char Get the char of an enum type. If not existing returns empty char ('\0')
GetVector2(Enum) Vector2 Get the Vector2 of an enum type. If not existing returns vector2.zero
GetVector3(Enum) Vector3 Get the Vector3 of an enum type. If not existing returns vector3.zero
GetRandomEnumValue T Retrieves a random enum value of the specified type. Returns a random enum value of type T
Vector3 use case

Vector 3 attributes

image

Enum with Vector3

image

Using the enums Vector3

image

GetRandomEnumValue use case

image

Source

Static class

EnumExtensions.cs

Attributes

  1. CharValue
  2. StringValue
  3. Vector2Value
  4. Vector3Value
⚠️ **GitHub.com Fallback** ⚠️