bevy/examples/stress_tests
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
..
bevymark.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
many_animated_sprites.rs Remove redundant imports (#12817) 2024-04-01 19:59:08 +00:00
many_buttons.rs Have EntityCommands methods consume self for easier chaining (#14897) 2024-08-26 18:24:59 +00:00
many_cubes.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
many_foxes.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
many_gizmos.rs Fix floating point math (#15239) 2024-09-16 23:28:12 +00:00
many_glyphs.rs Rename BreakLineOn to LineBreak (#15583) 2024-10-01 22:30:50 +00:00
many_lights.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
many_sprites.rs Remove redundant imports (#12817) 2024-04-01 19:59:08 +00:00
README.md Add a stress test profile (#6901) 2022-12-20 15:59:41 +00:00
text_pipeline.rs Rename BreakLineOn to LineBreak (#15583) 2024-10-01 22:30:50 +00:00
transform_hierarchy.rs Migrate bevy_transform to required components (#14964) 2024-09-27 17:06:48 +00:00
warning_string.txt Added performance warning when running stress test examples in debug mode (#5029) 2022-07-13 19:13:46 +00:00

Stress tests

These examples are used to stress test Bevy's performance in various ways. These should be run with the "stress-test" profile to accurately represent performance in production, otherwise they will run in cargo's default "dev" profile which is very slow.

Example Command

cargo run --profile stress-test --example <EXAMPLE>