Provides enumeration values utilities for Unity.
- Fast utilitiy methods for enum. (GetValue, GetNames, IsDefined, TryParase etc..)
- Automate the creation of Unity's constant values as enumerations. (Scene, Tag, Layer, SortingLayer)
- Install from UnityPackage from Release Page
- Package Manager
Download .unitypackage from Release Page
{
"dependencies": {
"com.xtaltools.unienum": "https://github.com/neptaco/UniEnum.git?path=src/UniEnum.Unity/Assets/UniEnum"
}
}
.NET | UniEnum |
---|---|
Enum.GetNames(typeof(EnumType)) | UniEnum.GetNames<EnumType>() |
Enum.GetValues(typeof(EnumType)) | UniEnum.GetValues<EnumType>() |
Enum.IsDefined(typeof(EnumType), v) | UniEnum.IsDefined<EnumType>(v) 1 |
Enum.TryParse(typeof(EnumType)) | UniEnum.TryParse<EnumType>(v) |
Open ProjectSettings -> UniEnum
and set the generation target.
Target | Generated classes |
---|---|
Scene | SceneId SceneName ScenePath |
Layer | LayerId LayerMaskValue |
SortingLayer | SortingLyaerId SortingLayerName |
Tag | TagName |
Call the following method.
UnityConstantValuesGenerator.UpdateSceneValues(EditorBuildSettingScenes[] scenes)
This library is under the MIT License.
Footnotes
-
UniEnum.IsDefined
is case sensitive. ↩