Skip to content
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

Problem with all_children_iter #12

Open
eldyer opened this issue Jun 23, 2019 · 1 comment
Open

Problem with all_children_iter #12

eldyer opened this issue Jun 23, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@eldyer
Copy link

eldyer commented Jun 23, 2019

The following test fails:

#[test]
fn test() {
        let mut world = World::new();
        world.register::<Parent>();
        let mut system = HierarchySystem::<Parent>::new();
        System::setup(&mut system, &mut world.res);

        let e3 = world.create_entity().build();
        let e1 = world.create_entity().build();
        let e2 = world.create_entity().build();
        let e0 = world.create_entity().build();

        world.write_storage::<Parent>().insert(e2, Parent {entity: e1 });
        world.write_storage::<Parent>().insert(e1, Parent {entity: e0 });
        world.write_storage::<Parent>().insert(e3, Parent {entity: e2 });

        system.run_now(&mut world.res);
        world.maintain();

        let hierarchy = world.read_resource::<Hierarchy<Parent>>();
        assert!(hierarchy.all_children_iter(e0).eq([e1, e2, e3].iter().cloned()));
    }

However, it works if I change the order of the entity creation into e.g.:

        let e0 = world.create_entity().build();
        let e1 = world.create_entity().build();
        let e2 = world.create_entity().build();
        let e3 = world.create_entity().build();
@torkleyy torkleyy added the bug Something isn't working label Jun 23, 2019
@torkleyy torkleyy self-assigned this Jun 23, 2019
@torkleyy torkleyy removed their assignment Jul 8, 2019
@jaynus
Copy link

jaynus commented Jul 8, 2019

Probably related to amethyst/amethyst#1549

mrhatman added a commit to mrhatman/amethyst that referenced this issue Feb 2, 2020
bors bot added a commit to amethyst/amethyst that referenced this issue Mar 9, 2020
2117: States ui hierarchy issue r=azriel91 a=mrhatman

## Description

Fixed an issue where the states ui example would load incorrectly during fast transitions.

The issue was with delete hierarchy and its call to all_children_iter. rustgd/specs-hierarchy#12

## PR Checklist

By placing an x in the boxes I certify that I have:

- [x] Updated the content of the book if this PR would make the book outdated.
- [x] Added a changelog entry if this will impact users, or modified more than 5 lines of Rust that wasn't a doc comment.
- [ ] Added unit tests for new code added in this PR.
- [x] Acknowledged that by making this pull request I release this code under an MIT/Apache 2.0 dual licensing scheme.

If this modified or created any rs files:

- [x] Ran `cargo +stable fmt --all`
- [x] Ran `cargo clippy --all --features "empty"`
- [x] Ran `cargo test --all --features "empty"`


Co-authored-by: mrhatman <[email protected]>
Co-authored-by: Azriel Hoh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants