EcsRx / ecsrx

A reactive take on the ECS pattern for .net game developers
MIT License
520 stars 36 forks source link

Entity AddComponent type constaint fix and Group.Empty promotion #31

Closed Fijo closed 2 years ago

Fijo commented 2 years ago

I just found out why I often can't use the IEntity.AddComponent extension with the overload where you can pass in the instance of the component to be added. I used to just fall back to using the IEntity.AddComponents extension method (which uses params) but today I fixed the issue with the other one. Note that the new() constraint makes sense for the other overload there's no component instance passed in there. Hence why I assume this was a copy paste oversight.

I also included some minor changes promoting the use of EmptyGroup and adding a static singleton for that on Group.