-
Notifications
You must be signed in to change notification settings - Fork 10
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
No longer works on SceneBundles #6
Comments
Can you show me a minimal test case, or a minimal output save file? I'm seeing these components in #[derive(Default, Bundle)]
pub struct SceneBundle {
/// Handle to the scene to spawn
pub scene: Handle<Scene>,
pub transform: Transform,
pub global_transform: GlobalTransform,
#[cfg(feature = "bevy_render")]
pub visibility: Visibility,
#[cfg(feature = "bevy_render")]
pub computed_visibility: ComputedVisibility,
} Are all of these components present in your save output? Is Edit: I haven't been using |
So I had forgotten that I forked this repo and added .pipe(remove_component::<ComputedVisibility>) to the save_into_file function. Trying it again I get the error: With .pipe(remove_component::, and manually adding "bevy_render::view::visibility::ComputedVisibility" to the ron the error goes away however the component isn't added and doesn't show up in bevy-inspector-egui. Don't know if ComputedVisibilityFlags is the culprit or if it's silently failing somewhere else? Doesn't seem anything has changed in SceneBundle between 0.10 and 0.11 but I am keen on getting this to work, most of what I'm saving with this plugin are SceneBundle objects, any pointer in the right direction would be greatly appreciated! Minimal ron: (
resources: {},
entities: {
8589934640: (
components: {
"bevy_transform::components::transform::Transform": (
translation: (
x: 2.0,
y: 0.03,
z: 3.0,
),
rotation: (0.0, 1.0, 0.0, -0.00000004371139),
scale: (
x: 0.1,
y: 0.1,
z: 0.1,
),
),
"bevy_transform::components::global_transform::GlobalTransform": ((
matrix3: (
x_axis: (
x: -0.1,
y: 0.0,
z: 0.000000008742278,
),
y_axis: (
x: 0.0,
y: 0.1,
z: 0.0,
),
z_axis: (
x: -0.000000008742278,
y: 0.0,
z: -0.1,
),
),
translation: (
x: 2.0,
y: 0.03,
z: 3.0,
),
)),
"bevy_hierarchy::components::children::Children": ([
1612,
]),
"bevy_asset::handle::Handle<bevy_scene::scene::Scene>": (
id: AssetPathId(((15150937905447474773), (3199274184615654509))),
),
"bevy_render::view::visibility::Visibility": Inherited,
"bevy_core::name::Name": (
hash: 8068448145236990257,
name: "TestCarScene",
),
"proto_game::systems::gameplay::gameplay_setup::TestCarScene": (),
},
),
},
) |
Similar issue occuring with DynamicScenes here |
There is a lot of components in Bevy that derive From what I'm seeing in Bevy 11.2 code (Visibility logic seems to have changed entirely on latest), both With the latest version of this crate, you can pass a pub fn save_into_file_on_event<R: SaveIntoFileRequest + Event>() -> SavePipeline {
// Note: This is a single system, but still returned as `SystemConfigs` for easier refactoring.
filter::<With<Save>>
.pipe(save)
.pipe(file_from_event::<R>)
.pipe(into_file_dyn)
.pipe(finish)
.run_if(has_event::<R>)
.in_set(SaveSet::Save)
} For example: pub fn filter_without_visibility<Filter: ReadOnlyWorldQuery>(entities: Query<Entity, Filter>) -> SaveFilter {
let mut scene = SceneFilter::default();
scene.deny::<ComputedVisibilityFlags>();
SaveFilter {
entities: EntityFilter::allow(&entities),
scene,
}
} You can use this to avoid Then on load side, to be 100% safe, I'd recommend just checking all entities with a Theoretically, this would guarantee that the loaded visibility data is identical to runtime visibility data, and so everything else should work. |
Thanks for this, I've tried your suggestion Entity {some entity} does not exist Encountered a panic in exclusive system Panic occurs in Edit: Not sure exactly why this is happening, but within if let Some(mut e) = world.get_entity_mut(entity) {
e.insert(bundle.clone());
}; seems to have done the trick! Not sure what happens with missing entities though. |
If you're getting missing entity panics there, it suggests the I'm concerned your workaround of using I'd suggest debugging to see what exactly is inside the loaded pub fn load(
In(result): In<Result<Saved, LoadError>>,
world: &mut World,
) -> Result<Loaded, LoadError> {
let Saved { scene } = result?;
let mut entity_map = EntityMap::default();
scene.write_to_world(world, &mut entity_map)?;
Ok(Loaded { entity_map }) // <-------------
} You can compare the entities inside the |
You're right it's not a solution by any means I'm closing this issue and debugging seperately as it's probably beyond the scope of this crate, I'll let you know if I find anything interesting though. Thanks for the help! |
Sorry if this is a simple mistake but this crate used to work in bevy 10 for SceneBundles, I can't seem to get it to load a scene in 11.2
I have a simple SceneBundle, I've registered the type TestCarScene, the save.ron file does save the component correctly however when calling load_from_file("./data/save.ron") it no longer renders the scene. Am I missing something simple? I have regeneration systems for other visual components such as meshes however I swear the scenebundle use to just work out of the box.
The text was updated successfully, but these errors were encountered: