bevy/examples/asset
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
..
files Add example for using .meta files (#12882) 2024-04-08 17:10:56 +00:00
processing bevy_asset: Improve NestedLoader API (#15509) 2024-10-01 14:14:04 +00:00
alter_mesh.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
alter_sprite.rs Add sprite and mesh alteration examples (#15298) 2024-09-22 01:18:40 +00:00
asset_decompression.rs bevy_asset: Improve NestedLoader API (#15509) 2024-10-01 14:14:04 +00:00
asset_loading.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
asset_settings.rs Fix unfinished sentence in a comment in asset_settings example (#13243) 2024-05-05 14:13:27 +00:00
custom_asset.rs Cleanup unneeded lifetimes in bevy_asset (#15546) 2024-09-30 21:54:59 +00:00
custom_asset_reader.rs Optimize common usages of AssetReader (#14082) 2024-07-01 19:59:42 +00:00
embedded_asset.rs Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
extra_source.rs Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
hot_asset_reloading.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
multi_asset_sync.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
repeated_texture.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00