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§
Sourcetype UnloadFilter: QueryFilter
type UnloadFilter: QueryFilter
A QueryFilter used as the initial filter for selecting entities to unload.
Required Methods§
Provided Methods§
Sourcefn before_load(&mut self, _world: &mut World)
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.
Sourcefn before_unload(&mut self, _world: &mut World, _entities: &[Entity])
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.
Sourcefn after_load(
&mut self,
_world: &mut World,
_result: &Result<Loaded, LoadError>,
)
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.