-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Unable to directly spawn gltf that does not require components #102
Comments
@GitGhillie how did you workaround this? |
My idea was to use bevy_asset_loader as I do normally with bevy_gltf_components, and then delay spawning one of the scenes like so: .add_systems(OnEnter(GameState::AssetsLoaded), spawn_A)
.add_systems(
OnEnter(GameState::AssetsLoaded),
spawn_B.run_if(on_timer(Duration::new(5, 0))),
) However, this does not work and only spawns one of A and B... which means the issue I had with bevy_xpbd is maybe an issue with bevy_asset_loader instead. Need to find a different workaround :( |
hmm that is a scenario I did not encounter before, thanks for the bug report ! So changing track_new_gltf (excuse the poor code quality, very tired & sick) let handle = asset_server.get_id_handle(*id);
if let Some(handle) = handle {
tracker.add_gltf(handle.clone());
debug!("gltf created {:?}", handle.clone());
}else {
warn!("this gltf should have been loaded, no handle available, not processing it")
}
``` |
That seems to do the trick! Now I'm running into an issue where the scene loaded with the asset loader only rarely shows up, but I think that's then something to do with bevy_asset_loader. |
@GitGhillie is its a random failure of a scene to show up ? |
I made a minimal example to illustrate the problem I'm having with bevy/bevy_asset_loader: https://github.com/GitGhillie/asset_loading_mre/blob/main/src/main.rs Not sure how to manually create a strong handle but appending #Scene0 to the paths fixes the scenes randomly getting swapped. With my Bevy 0.11 project I was already doing this but now with 0.12 it seems like bevy_gltf_components doesn't work when a scene is spawned with #Scene0. I'm getting "this gltf should have been loaded, no handle available, not processing it" from your hotfix. |
@GitGhillie I suddenly remembered that I faced this issue as well ! |
Hmm I think the fix for that already lives on 0.12.1 :( When I have more time I'll try to make a minimal reproducer without bevy_asset_loader, then I can also easily test against bevy main |
I moved the discussion about asset loading here btw NiklasEi/bevy_asset_loader#182 |
Hi @GitGhillie would you mind trying out this pr to see if it solve your issues ? |
Looks like it works! I can now load with and without using #Scene0 and with or without components |
Awesome , thanks for trying it out so quickly ! |
I want to spawn a scene and because of an issue I ran into (Jondolf/avian#304 if you want more context) I figured I would just spawn it directly during Startup, as this scene doesn't have any components that need to be added using bevy_gltf_components. However, this results in a panic with message "this gltf should have been loaded".
It's not too bad to work around but I'm guessing it's not the intended behavior of the crate.
The text was updated successfully, but these errors were encountered: