#Observer observes inconsistent hierarchy

4 messages · Page 1 of 1 (latest)

uneven blaze
#

I've added an observer

fn add_phys_skelet(
    trigger: Trigger<OnAdd, GltfExtras>,
    parent: Query<&Parent>,
) {
    let e = trigger.entity();
    info!(?e);

    for p in parent.iter_ancestors(e) {
        info!(?p);
    }
}

And it reports nonsensical parent entities when spawning a SceneBundle.
Having the same code in a regular system that runs on Update reports proper hierarchy.

I am assuming it triggers before the entity is fully moved from the scene world into the "main" world.

#

Ah but I guess this is by design. The SceneLoader loads the scene and adds components and there is no "commit" to this transaction, so the events fire in the middle of created scene

uneven blaze
plucky hamlet
#

I just hit this as well, and I'm not sure that the "Just use SceneInstanceReady" solution really works, since I'd really like to be able to use an OnAdd, Parent observer for things outside of scene loading