#Bevy Scene Empty
9 messages · Page 1 of 1 (latest)
DynamicSceneBuilder needs a list of entities and resources to replicate
Source of the Rust file src/dynamic_scene.rs.
ooh thx
Err(Message("type bevy_platform::sync::Arc<core::sync::atomic::AtomicBool> did not register the ReflectSerialize or ReflectSerializeWithRegistry type data. For certain types, this may need to be registered manually using register_type_data (stack: bevy_a11y::AccessibilityRequested -> bevy_platform::sync::Arc<core::sync::atomic::AtomicBool>)"))
is it normal ?
fn save_world(
world: &mut World,
) {
let mut query = world.query_filtered::<Entity, With<ComponentA>>();
let mut hash_set = HashSet::new();
hash_set.insert(TypeId::of::<ResourceA>());
let scene = DynamicSceneBuilder::from_world(world).extract_entities(
query.iter(world)
)
.with_resource_filter(SceneFilter::Allowlist(hash_set))
.extract_resources()
.build();
let type_registry = world.resource::<AppTypeRegistry>().read();
let serialized = scene.serialize(&type_registry).unwrap();
info!("{:?}", serialized);
IoTaskPool::get()
.spawn(async move {
// Write the scene RON data to file
File::create(format!("assets/scene_{}.ron", chrono::Utc::now().timestamp()))
.and_then(|mut file| file.write(serialized.as_bytes()))
.expect("Error while writing scene to file");
})
.detach();
}
it worked
maybe better to deny_all_resources().allow_resource::<>()