I want to store some SpriteBundles in a scene file and later load them with a DynamicSceneBundle. I tried to find the correct syntax by storing a SpriteBundle, but this results in an error.
Example Code:
let mut scene_world = World::new();
scene_world.insert_resource(world.resource::<AppTypeRegistry>().clone());
let asset_server = world.resource::<AssetServer>();
scene_world.spawn(
SpriteBundle {
texture: asset_server.load("maps/desert/desert.bmp"),
transform: Transform::from_xyz(0.0, 0.0, -10.0),
..default()
},
);
let type_registry = world.resource::<AppTypeRegistry>();
let scene = DynamicScene::from_world(&scene_world);
info!("{}", scene.serialize_ron(type_registry).unwrap());
This works for simple Components just fine.
The Error:
called `Result::unwrap()` on an `Err` value: Message("Type 'bevy_render::view::visibility::ComputedVisibilit
yFlags' did not register ReflectSerialize")
Those this mean, that I can not store Handle<T> in a ron file yet?
This seems to be a type from bevy internally that does not support Serialization.