Closed 1115803755 closed 2 years ago
Collector caches entities on Added/Removed/AddedOrRemoved, it looks as intended.
I mean why did group.OnEntityRemoved and group.OnEntityAdded add the same EventCache
I mean why did group.OnEntityRemoved and group.OnEntityAdded add the same EventCache
group.OnEntityRemoved
and group.OnEntityAdded
can add to the same HashSet. Based on how Collector was set up.
Think you, I got it wrong.
Hi,
I have found a bug want to contribute.
Here's some code
public void Activate() { for (int i = 0; i < _groups.Length; i++) { var group = _groups[i]; var groupEvent = _groupEvents[i]; switch (groupEvent) { case GroupEvent.Added: group.OnEntityAdded -= _addEntityCache; group.OnEntityAdded += _addEntityCache; break; case GroupEvent.Removed: group.OnEntityRemoved -= _addEntityCache; group.OnEntityRemoved += _addEntityCache; break; case GroupEvent.AddedOrRemoved: group.OnEntityAdded -= _addEntityCache; group.OnEntityAdded += _addEntityCache; group.OnEntityRemoved -= _addEntityCache; group.OnEntityRemoved += _addEntityCache; break; } } }
As you can see, "group.OnEntityRemoved += _addEntityCache;" is add wrong EventHandle