bevy/crates/bevy_scene/src
Tim eb51b4c28e
Migrate scenes to required components (#15579)
# Objective

A step in the migration to required components: scenes!

## Solution

As per the [selected
proposal](https://hackmd.io/@bevy/required_components/%2FPJtNGVMMQhyM0zIvCJSkbA):
- Deprecate `SceneBundle` and `DynamicSceneBundle`.
- Add `SceneRoot` and `DynamicSceneRoot` components, which wrap a
`Handle<Scene>` and `Handle<DynamicScene>` respectively.

## Migration Guide
Asset handles for scenes and dynamic scenes must now be wrapped in the
`SceneRoot` and `DynamicSceneRoot` components. Raw handles as components
no longer spawn scenes.

Additionally, `SceneBundle` and `DynamicSceneBundle` have been
deprecated. Instead, use the scene components directly.

Previously:
```rust
let model_scene = asset_server.load(GltfAssetLabel::Scene(0).from_asset("model.gltf"));

commands.spawn(SceneBundle {
    scene: model_scene,
    transform: Transform::from_xyz(-4.0, 0.0, -3.0),
    ..default()
});
```
Now:
```rust
let model_scene = asset_server.load(GltfAssetLabel::Scene(0).from_asset("model.gltf"));

commands.spawn((
    SceneRoot(model_scene),
    Transform::from_xyz(-4.0, 0.0, -3.0),
));
```
2024-10-01 22:42:11 +00:00
..
bundle.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
components.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
dynamic_scene.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
dynamic_scene_builder.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
lib.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
scene.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
scene_filter.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
scene_loader.rs Cleanup unneeded lifetimes in bevy_asset (#15546) 2024-09-30 21:54:59 +00:00
scene_spawner.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
serde.rs Add VisitEntities for generic and reflectable Entity iteration (#15425) 2024-09-30 17:32:03 +00:00