Skip to content

Conversation

@JoNax97
Copy link
Contributor

@JoNax97 JoNax97 commented Oct 14, 2025

This fixes an issue/limitation of the Component Registry generator, where generic components were being registered directly instead of registering the concrete types derived from it. We encountered this in our own project.

Before:

[ModuleInitializer]
        public static void Initialize()
        {
           ArrayRegistry.Add<Events<T>>();
           ArrayRegistry.Add<DespawnOn<T>>();
        }

This caused a compilation error.

After:

[ModuleInitializer]
        public static void Initialize()
        {
            ArrayRegistry.Add<DespawnOn<CollisionEvent>>();
            ArrayRegistry.Add<DespawnOn<DamageEvent>>();
            ArrayRegistry.Add<Events<CollisionEvent>>();
        }

The concrete types don't need to be manually registered, the generator automatically scans for them.

@JoNax97
Copy link
Contributor Author

JoNax97 commented Oct 14, 2025

@genaray let me know if I'm missing anything. I'm not the most well versed with Source Generators

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant