Doraku / DefaultEcs.Analyzer

Roslyn analyzers for DefaultEcs users.
MIT No Attribution
13 stars 1 forks source link

Add code generation for World subscriptions #9

Open DagobertDev opened 2 years ago

DagobertDev commented 2 years ago

Currently many of my AEntitySetSystems use world subscriptions (like World.SubscribeComponentAdded or World.SubscribeComponentRemoved) to handle logic thats related to the system, but doesn't belong in the Update method. Because the subscription happens in the constructor, constructors are needed for many systems, where otherwise the generated constructor would be enough. Having an attribute to automaticially subscribe a method on world events would be very helpful.

Doraku commented 2 years ago

That's a good idea, using something similar to SubscribeAttribute for IPublisher.Subscribe completely slipped my mind when I added those apis.