pub trait PrefabData<'a> {
    type SystemData: SystemData<'a>;
    type Result;

    fn add_to_entity(
        &self,
        entity: Entity,
        system_data: &mut Self::SystemData,
        entities: &[Entity]
    ) -> Result<Self::Result, PrefabError>; fn load_sub_assets(
        &mut self,
        _progress: &mut ProgressCounter,
        _system_data: &mut Self::SystemData
    ) -> Result<bool, PrefabError> { ... } }
Expand description

Trait for loading a prefabs data for a single entity

Required Associated Types

SystemData needed to perform the load

The result type returned by the load operation

Required Methods

Add the data for this prefab onto the given Entity

This can also be used to load resources, the recommended way of doing so is to put the resources on the main Entity of the Prefab

Parameters:
  • entity: Entity to load components on, or the root Entity for the resource scenario
  • system_data: SystemData needed to do the loading
  • entities: Some components need access to the entities that was created as part of the full prefab, for linking purposes, so this contains all those Entitys.

Provided Methods

Trigger asset loading for any sub assets.

Parameters:
  • progress: Progress structure that needs to be used for tracking progress of sub loads
  • system_data: SystemData for the prefab
Returns
  • Err(error) - if an Error occurs
  • Ok(false) - if no sub assets need loading
  • Ok(true) - if sub assets need loading, in this case the sub asset load must be added to the given progress tracker
Type parameters:
  • P: Progress tracker

Implementations on Foreign Types

Implementors