Closed gretkierewicz closed 1 year ago
Hi Piotr,
Yes, please go ahead and remove that. I think this is leftover from the earlier code, and I never really thought about it. Thanks for opening the ticket.
@benmoran56
I wonder why remove_component()
returns entity. Maybe could be good idea to return removed component instance? Imo that would make much more sense if you would like to transfer it to some other entity later on.
Good question. That's pointless since the entity id is already known.
Returning the entity instance could be useful, as long as it's not too expensive.
Describe the bug As for Single Responsibility Principle remove component should do just that but it removes empty entity as well. As I'm creating tests for my own project, I need to populate entity with some dummy component to prevent that and test cleaning another component logic.
To Reproduce
Expected behavior I assume that cleaning components should not clear entity. As removing and adding component should be independent from entity existence. Entity should be deleted by
delete_entity()
only and not under the hood so programmer has full control over it.Development environment:
Additional context I will create unit tests for it and fix if approved for implementation