Unclaimed Package Is this your package? Claim it to unlock full analytics and manage your listing.
Claim This Package

Install via UPM

Add to Unity Package Manager using this URL

https://www.pkglnk.dev/generated-type-registries.git
Generated Type Registries

README Markdown

Copy this to your project's README.md

Style
Preview
pkglnk installs badge
## Installation

Add **Generated Type Registries** to your Unity project via Package Manager:

1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/generated-type-registries.git
```

[![pkglnk](https://www.pkglnk.dev/badge/generated-type-registries.svg?style=pkglnk)](https://www.pkglnk.dev/pkg/generated-type-registries)

README

Generated Type Registries

Enables accessing specific types at runtime without reflection, compatible with IL2CPP and trimming.

Installation

Use the following URL in Unity's package manager:

https://github.com/popcron/generated-type-registries.git

Using

Create a type that contains all registered types by inheriting from TypeRegistry<T>:

public sealed class ItemTypesRegistry : TypeRegistry<IItem>
{
}

Then generate the code using the "Tools/Generate Type Registries" menu item:

Now all types can be accessed statically:

public interface IItem { }
public class Apple : IItem { }
public class Cherry : IItem { }

int appleIndex = ItemTypesRegistry.IndexOf<Apple>();
Type appleType = ItemTypesRegistry.GetType(appleIndex);

Comments

No comments yet. Be the first!