#Why would I add components to a system instead of just setting class variables?

1 messages · Page 1 of 1 (latest)

chilly stream
#

I just saw that each system has an associated entity which I can add components too. Why/When should I do that instead of just relying on normal class members?

visual cairn
#

Personally I think accessing other systems should be considered an anti pattern in ecs but ignoring my personal opinion,
it was added for ISystem which is not a class but a struct and is strongly discouraged from being accessed directly

chilly stream
#

Yes, but I am talking about system internal state, I can just make that as a struct or class member, can't I?

#

So these components are for global state that I want to syntactically associate with a specific system?

visual cairn
#

thematically it's kind of nice to store the systems internal state on the entity
in practice though, not worth the effort and I would only use these entities to share state between systems if required

#

Often sharing native containers etc, for example EntityCommandBufferSystem.Singleton