Closed genaray closed 2 years ago
When...
is a special rule used when created entity containers (set, map, ...) to make them reactive, they should contains entities respecting those rules (so for a WhenAdded<Resource>
, only entities which have had a Resource component added to them since the last time the Complete
method of the container was called). This is for delayed processing in a system, you have to enumerate the content yourself when you want to (in the case of a generated system like your code, you need to call the Update(state)
of the system like any other). If you didn't get anything even when adding Resource component on entities, maybe something is not working properly :(
SubscribeComponentAdded
is to add a callback for when a component is added on an entity, regardless of this entity full composition, and is called synchronously.
Is there a difference between those two ?
I lately tried to react on newly created entities like this :
But it never triggered when i created a new entity and set the
Resource
component. However, theSubscribeComponentAdded
works fine. So i wonder if theres a difference between them :)