-
-
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
Isolate component registration #17671
Isolate component registration #17671
Conversation
This was moved over from the original PR, and I copied this change in the wrong place.
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.
Makes sense to me, and the unsafe code is still sound (as far as I can tell).
Note that SparseSets are no longer present for all registered sparse set components, only those that have been spawned.
Maybe also add a comment to that effect on Storages.sparse_sets
?
Co-authored-by: SpecificProtagonist <[email protected]>
…lliottjPierce/bevy into isolate-component-registration
Done! Thanks @SpecificProtagonist for the review and suggestions. |
Github doesn't run fmt or course for commits from a review.
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.
Looks good! Thanks for pulling this out of the larger PR!
Co-authored-by: Chris Russell <[email protected]>
…lliottjPierce/bevy into isolate-component-registration
per Cart's suggestion.
These were fixes from changes caused by bevyengine#17679
Good stuff; I think this is a worthwhile cleanup regardless of the final design choice. |
Objective
Progresses #17569. The end goal here is to synchronize component registration. See the other PR for details for the motivation behind that.
For this PR specifically, the objective is to decouple
Components
fromStorages
. What components are registered etc should have nothing to do with what Storages looks like. Storages should only care about what entity archetypes have been spawned.Solution
Previously, this was used to create sparse sets for relevant components when those components were registered. Now, we do that when the component is inserted/spawned.
This PR proposes doing that in
BundleInfo::new
, but there may be a better place.Testing
In theory, this shouldn't have changed any functionality, so no new tests were created. I'm not aware of any examples that make heavy use of sparse set components either.
Migration Guide