Skip to main content

SceneSerializer

Trait SceneSerializer 

Source
pub trait SceneSerializer {
    // Required method
    fn populate_scene(
        &self,
        world: &World,
        entity_uuids: &HashMap<Entity, AssetUuid>,
        scene: &mut Scene,
    );
}
Expand description

Register a custom component type and serialize game-side state into a scene. A game that keeps its own data in a second world stores it through these hooks so save_scene_with and load_scene_with round-trip it alongside the engine entities. Game-side hook invoked at scene save. Implementors iterate their world(s), match entities to the engine entities listed in entity_uuids, and append typed payloads to the matching SceneEntity::components::game_components and/or Scene::game_resources.

Required Methods§

Source

fn populate_scene( &self, world: &World, entity_uuids: &HashMap<Entity, AssetUuid>, scene: &mut Scene, )

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§