-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fallback to remove components one by one when failing to remove a bundle #719
Conversation
use std::collections::hash_map::Entry; | ||
|
||
self.flush(); | ||
let loc = self.entities.get_mut(entity)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retrieving the location here and in remove() is redundant work. I'd prefer it if we found a way to only do this once (ex: pass the location into remove_bundle_internal)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was not possible, as location needs to be an &mut
that references self
, which also needs to be an &mut
to call remove_bundle_internal
.
I was able to remove getting the location from remove
by retrieving the bundle value in remove_bundle_internal
. When coming from remove_one_by_one
, this will not return the expected value as we actually can't get it, that's why there is a parameter check_presence
set to false when coming from this function...
2c3f68b
to
76d405f
Compare
768ae8c
to
fc83a1b
Compare
rebased / updated to master (by using We can always just duplicate code if we need to, but in this case its all probably in the noise anyway. I also removed the uber unsafe block in favor of slightly more scoped blocks. |
fixes #698
when failing to remove a bundle, issue a warn log and fallback to remove components from bundle one by one instead of panicking.
see #710 for discussion on fallback