Skip to content

Thundernerd/Unity3D-LayersTagsGenerator

Repository files navigation

Layers & Tags Generator

GitHub package.json version GitHub issues GitHub pull requests GitHub license GitHub last commit

A package that contains generators that will generate classes containing the project's Layers and Tags for easy access.

Installation

  1. The package is available on the openupm registry. You can install it via openupm-cli.
openupm add net.tnrd.layertagsgenerator
  1. Installing through a Unity Package created by the Package Installer Creator from Needle

Usage

Once you have installed the package into your project you can access the generators through the menu as shown below.

You can generate the Tags, Layers, and Sorting Layers all separately by using their respective menu items, or generate them all by using the Generate All menu item.

alt

Once you have generated one or more through the menu, you will see the files appear in your project located int he Generated folder, which resides at top level in your Assets folder.

alt

To use the generated files you simply access them through their classes which are: Tags, Layers, and SortingLayers. Below is an example of a use case for the Tags.

public class Foo : MonoBehaviour
{
    private void OnCollisionEnter(Collision other)
    {
        if (other.transform.CompareTag(Tags.PLAYER))
        {
            ...
        }
    }
}

Support

Layers & Tags Generator is an open-source project that I hope helps other people. It is by no means necessary but if you feel generous you can support me by donating.

ko-fi

Contributions

Pull requests are welcomed. Please feel free to fix any issues you find, or add new features.

About

Code generators for Layers and Tags

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages