https://github.com/doyasu24/unitynamescodegenerator
NamesCodeGenerator for Unity generates type safe value objects and static classes from Tag, Layer, SortingLayer, and Scene.
https://github.com/doyasu24/unitynamescodegenerator
codegenerator unity unity-editor
Last synced: 10 months ago
JSON representation
NamesCodeGenerator for Unity generates type safe value objects and static classes from Tag, Layer, SortingLayer, and Scene.
- Host: GitHub
- URL: https://github.com/doyasu24/unitynamescodegenerator
- Owner: doyasu24
- License: mit
- Created: 2017-12-11T19:28:57.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-11-28T12:45:31.000Z (over 3 years ago)
- Last Synced: 2025-04-10T17:34:05.831Z (about 1 year ago)
- Topics: codegenerator, unity, unity-editor
- Language: C#
- Homepage:
- Size: 636 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UnityNamesCodeGenerator
NamesCodeGenerator for Unity generates type safe value objects and static classes from Tag, Layer, SortingLayer, and Scene.
# Install
you can add `https://github.com/doyasu24/UnityNamesCodeGenerator.git?path=Assets/Plugins/NamesCode#3.1.0` to Package Manager

or import unitypackage from [release page](https://github.com/doyasu24/UnityNamesCodeGenerator/releases).
# How to use
Execute `Tools/NamesCode/GenerateCode` from menu to generate the code.

## Output directory
By default, code is generated in `Assets/NamesCode/Generated` directory.
To change the output directory, create a `GeneratorSetting.asset` and place it somewhere in your project.
For example, `Assets/NamesCode/Editor/GeneratorSetting.asset`.

Then, change the value of `OutputDirectory` in GeneratorSetting.

# Code Generation Result
The format policy follows `Microsoft Visual Studio`
```:Layers.cs
// Generated code by NamesCodeGenerator
namespace NamesCode
{
public static class Layers
{
public static readonly LayerName Default = new LayerName("Default", 0);
public static readonly LayerName TransparentFX = new LayerName("TransparentFX", 1);
public static readonly LayerName IgnoreRaycast = new LayerName("Ignore Raycast", 2);
public static readonly LayerName Water = new LayerName("Water", 4);
public static readonly LayerName UI = new LayerName("UI", 5);
public static readonly LayerName[] Names =
{
Default,
TransparentFX,
IgnoreRaycast,
Water,
UI,
};
}
}
```
# License
MIT