-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Scene not loading when entity has GlobalTransform or Children #6573
Copy link
Copy link
Closed
Labels
A-ReflectionRuntime information about typesRuntime information about typesA-ScenesComposing and serializing ECS objectsComposing and serializing ECS objectsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior
Description
Bevy version
0.9.0
What you did
I attempted to save and load a scene
fn load_scene(
mut commands: Commands,
assets: Res<AssetServer>,
) {
commands.spawn(DynamicSceneBundle {
scene: assets.load("scenes/test.scn.ron"),
..default()
});
}
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
Scene does not load and logs a message to the console.
Additional information
Logs
When an entity is saved with a GlobalTransform component
WARN bevy_asset::asset_server: encountered an error while loading an asset: Expected float
When loading a scene with an entity that has children.
WARN bevy_asset::asset_server: encountered an error while loading an asset: no registration found for type `smallvec::SmallVec<[bevy_ecs::entity::Entity; 8]>`
Removing both components from the ron file allows the scene to load. Obviously doing so might cause weird behaviors since entities don't have any of these components anymore.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-ReflectionRuntime information about typesRuntime information about typesA-ScenesComposing and serializing ECS objectsComposing and serializing ECS objectsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior