一键导入
bevy-scenes
Reference for Bevy scenes — saving and loading entity/component snapshots via reflection, DynamicWorld, WorldInstanceSpawner, and DynamicWorldRoot.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Reference for Bevy scenes — saving and loading entity/component snapshots via reflection, DynamicWorld, WorldInstanceSpawner, and DynamicWorldRoot.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Reference for Avian physics engine — rigid bodies, colliders, joints, spatial queries, collision events, character controllers, and debug rendering.
Reference for loading, managing, and tracking assets in Bevy — AssetServer, handles, loading states, events, custom loaders, and hot reloading.
Reference for playing and controlling audio in Bevy — AudioPlayer, AudioSink, spatial audio, volume, and playback settings.
Reference for Bevy Scene Notation (BSN) — the bsn! macro for defining inline scenes with components, children, relationships, observers, and dynamic props.
Reference for cameras in Bevy — Camera2d, Camera3d, viewports, projection, render layers, mouse-to-world, and free camera controllers.
Reference for Bevy Commands — spawning/despawning entities, inserting/removing components, custom commands, trait extensions, and testing.
| name | bevy-scenes |
| description | Reference for Bevy scenes — saving and loading entity/component snapshots via reflection, DynamicWorld, WorldInstanceSpawner, and DynamicWorldRoot. |
| metadata | {"crate":"bevy_scene","bevy":"0.19"} |
DynamicWorld — serializable representation (no own world), stores Vec<Box<dyn PartialReflect>> resources + Vec<DynamicEntity> entitiesfn save_scene(world: &mut World) {
let scene = DynamicWorld::from_world(world);
let type_registry = world.resource::<AppTypeRegistry>();
let reg = type_registry.read();
let serialized = scene.serialize(®).unwrap();
// write serialized to file (e.g., "scene.scn.ron")
}
Three ways:
// 1. DynamicWorldRoot component
fn load(asset_server: Res<AssetServer>, mut commands: Commands) {
commands.spawn(DynamicWorldRoot(asset_server.load("scene.scn.ron")));
}
// 2. WorldInstanceSpawner::spawn_dynamic
// 3. DynamicWorldBuilder
WorldInstanceReady fires when the scene is fully loaded. SceneInstance component is added to the root entity:
fn on_loaded(mut spawner: ResMut<WorldInstanceSpawner>, query: Query<&SceneInstance>) {
for instance in &query {
spawner.despawn_instance_sync(world, instance);
}
}
(
resources: { "my::Resource": (score: 1) },
entities: {
4294967297: (
components: {
"bevy_transform::components::transform::Transform": (
translation: (0.0, 0.0, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0),
),
},
),
},
)
#[derive(Reflect)] for auto-registrationFromWorld on a component customizes initialization during load#[reflect(skip_serializing)] excludes fields from serialization