Skip to content

Scene fails to serialize #6627

@ShinySapphic

Description

@ShinySapphic

Bevy version

0.9.0 main 688f13c

What you did

I attempted to serialize a scene using the following code:

fn save_scene(world: &mut World) {
    for entity in world
        .query_filtered::<Entity, With<Camera>>()
        .iter(world)
        .collect::<HashSet<_>>()
    {
        world.despawn(entity);
    }

    let type_registry = world.resource::<AppTypeRegistry>();
    let scene = DynamicScene::from_world(world, type_registry);

    let serialized = scene
        .serialize_ron(type_registry)
        .expect("Failed to serialize the world");

    #[cfg(not(target_arch = "wasm32"))]
    IoTaskPool::get()
        .spawn(async move {
            fs::write("assets/scenes/test.scn.ron", serialized.as_bytes())
                .expect("Failed to write to file");
        })
        .detach();
}

What went wrong

App panics and scene is not saved

Additional information

Logs

Failed to serialize the world: Message("no registration found for dynamic type with name bevy_render::view::visibility::ComputedVisibilityFlags")

I think it might be a result of #6305 but I am not certain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ScenesSerialized ECS data stored on the diskC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions