-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - Remove BuildWorldChildren
impl from WorldChildBuilder
#6727
Conversation
push_child_unchecked(self.world, parent_entity, entity); | ||
self.current_entity = Some(entity); | ||
let entity = self.world.spawn(Parent(self.parent)).id(); | ||
push_child_unchecked(self.world, self.parent, entity); | ||
if let Some(mut added) = self.world.get_resource_mut::<Events<HierarchyEvent>>() { |
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.
Are event's resources?
Why not just send the event, isn't a child always being added?
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.
The if let here is checking if the event resource itself exists (to reduce random panics).
bors r+ |
# Objective Remove an obscure and inconsistent bit of API. Simplify the `WorldChildBuilder` code. No idea why this even exists. An example of the removed API: ```rust world.spawn_empty().with_children(|parent| { parent.spawn_empty(); parent.push_children(&[some_entity]); // Does *not* add children to the parent. // It's actually identical to: parent.spawn_empty().push_children(&[some_entity]); }); world.spawn_empty().with_children(|parent| { // This just panics. parent.push_children(&[some_entity]); }); ``` This exists only on `WorldChildBuilder`; `ChildBuilder` does not have this API. Yeet. ## Migration Guide Hierarchy editing methods such as `with_children` and `push_children` have been removed from `WorldChildBuilder`. You can edit the hierarchy via `EntityMut` instead. Co-authored-by: devil-ira <justthecooldude@gmail.com>
Build failed (retrying...): |
# Objective Remove an obscure and inconsistent bit of API. Simplify the `WorldChildBuilder` code. No idea why this even exists. An example of the removed API: ```rust world.spawn_empty().with_children(|parent| { parent.spawn_empty(); parent.push_children(&[some_entity]); // Does *not* add children to the parent. // It's actually identical to: parent.spawn_empty().push_children(&[some_entity]); }); world.spawn_empty().with_children(|parent| { // This just panics. parent.push_children(&[some_entity]); }); ``` This exists only on `WorldChildBuilder`; `ChildBuilder` does not have this API. Yeet. ## Migration Guide Hierarchy editing methods such as `with_children` and `push_children` have been removed from `WorldChildBuilder`. You can edit the hierarchy via `EntityMut` instead. Co-authored-by: devil-ira <justthecooldude@gmail.com>
BuildWorldChildren
impl from WorldChildBuilder
BuildWorldChildren
impl from WorldChildBuilder
…#6727) # Objective Remove an obscure and inconsistent bit of API. Simplify the `WorldChildBuilder` code. No idea why this even exists. An example of the removed API: ```rust world.spawn_empty().with_children(|parent| { parent.spawn_empty(); parent.push_children(&[some_entity]); // Does *not* add children to the parent. // It's actually identical to: parent.spawn_empty().push_children(&[some_entity]); }); world.spawn_empty().with_children(|parent| { // This just panics. parent.push_children(&[some_entity]); }); ``` This exists only on `WorldChildBuilder`; `ChildBuilder` does not have this API. Yeet. ## Migration Guide Hierarchy editing methods such as `with_children` and `push_children` have been removed from `WorldChildBuilder`. You can edit the hierarchy via `EntityMut` instead. Co-authored-by: devil-ira <justthecooldude@gmail.com>
…#6727) # Objective Remove an obscure and inconsistent bit of API. Simplify the `WorldChildBuilder` code. No idea why this even exists. An example of the removed API: ```rust world.spawn_empty().with_children(|parent| { parent.spawn_empty(); parent.push_children(&[some_entity]); // Does *not* add children to the parent. // It's actually identical to: parent.spawn_empty().push_children(&[some_entity]); }); world.spawn_empty().with_children(|parent| { // This just panics. parent.push_children(&[some_entity]); }); ``` This exists only on `WorldChildBuilder`; `ChildBuilder` does not have this API. Yeet. ## Migration Guide Hierarchy editing methods such as `with_children` and `push_children` have been removed from `WorldChildBuilder`. You can edit the hierarchy via `EntityMut` instead. Co-authored-by: devil-ira <justthecooldude@gmail.com>
…#6727) # Objective Remove an obscure and inconsistent bit of API. Simplify the `WorldChildBuilder` code. No idea why this even exists. An example of the removed API: ```rust world.spawn_empty().with_children(|parent| { parent.spawn_empty(); parent.push_children(&[some_entity]); // Does *not* add children to the parent. // It's actually identical to: parent.spawn_empty().push_children(&[some_entity]); }); world.spawn_empty().with_children(|parent| { // This just panics. parent.push_children(&[some_entity]); }); ``` This exists only on `WorldChildBuilder`; `ChildBuilder` does not have this API. Yeet. ## Migration Guide Hierarchy editing methods such as `with_children` and `push_children` have been removed from `WorldChildBuilder`. You can edit the hierarchy via `EntityMut` instead. Co-authored-by: devil-ira <justthecooldude@gmail.com>
Objective
Remove an obscure and inconsistent bit of API.
Simplify the
WorldChildBuilder
code.No idea why this even exists.
An example of the removed API:
This exists only on
WorldChildBuilder
;ChildBuilder
does not have this API.Yeet.
Migration Guide
Hierarchy editing methods such as
with_children
andpush_children
have been removed fromWorldChildBuilder
.You can edit the hierarchy via
EntityMut
instead.