Generated Type Registries
Auto generates type registration to avoid finding them using reflection at runtime
com.popcron.generated-type-registries Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/generated-type-registries.git 
README Markdown
Copy this to your project's README.md
## 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
```
[](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!
Sign in to join the conversation
Sign In