Spy-Shifty / BrokenBricksECS

Rebuild of Unity3D upcoming Entity Component System !OUT OF DEVELOPMENT!
MIT License
162 stars 28 forks source link

Removing entities doesn't remove subscribed events #7

Closed enzi closed 6 years ago

enzi commented 6 years ago

Hello!

When removing entities and adding new ones the missing unsubscribe was calling deleted gameobjects. I've a small patch for GameObjectEntity in OnDestroy

private void OnDestroy() { if (_entityManager != null) { _entityManager.UnsubscribeOnEntityRemoved(_entity, this); _entityManager.UnsubscribeOnComponentAddedToEntity(_entity, this); _entityManager.UnsubscribeOnComponentRemovedFromEntity(_entity, this); _entityManager.DestroyEntity(_entity); } }

Spy-Shifty commented 6 years ago

Fixed df219079e25b720df213c7cea2bf2135530b30ba @Spy-Shifty Spy-Shifty committed 2 minutes ago