LoadEvent

Trait LoadEvent 

Source
pub trait LoadEvent: SingleEvent {
    type UnloadFilter: QueryFilter;

    // Required method
    fn input(&mut self) -> LoadInput;

    // Provided methods
    fn before_load(&mut self, _world: &mut World) { ... }
    fn before_unload(&mut self, _world: &mut World, _entities: &[Entity]) { ... }
    fn after_load(
        &mut self,
        _world: &mut World,
        _result: &Result<Loaded, LoadError>,
    ) { ... }
}
Expand description

A SingleEvent which starts the load process with the given parameters.

See also:

Required Associated Types§

Source

type UnloadFilter: QueryFilter

A QueryFilter used as the initial filter for selecting entities to unload.

Required Methods§

Source

fn input(&mut self) -> LoadInput

Returns the LoadInput of the load process.

Provided Methods§

Source

fn before_load(&mut self, _world: &mut World)

Called once before the load process starts.

This is useful if you want to modify the world just before loading.

Source

fn before_unload(&mut self, _world: &mut World, _entities: &[Entity])

Called once before unloading entities.

All given entities will be despawned after this call. This is useful if you want to update the world state as a result of unloading these entities.

Source

fn after_load( &mut self, _world: &mut World, _result: &Result<Loaded, LoadError>, )

Called for all entities after they have been loaded.

This is useful to undo any modifications done before loading. You also have access to Loaded here for any additional post-processing before [OnLoad] is triggered.

Implementors§