Function moonshine_save::save::save_with

source ·
pub fn save_with<F: QueryFilter, S: IntoSystem<(), SaveFilter, M>, M>(
    filter_source: S
) -> DynamicSavePipelineBuilder<F, S::System>
Expand description

Creates a DynamicSavePipelineBuilder which saves all entities with given entity filter F and a filter source S.

During the save process, all entities that match the given query F will be selected for saving. Additionally, any valid system which returns a SaveFilter may be used as a filter source S.

§Example

use bevy::prelude::*;
use moonshine_save::prelude::*;

fn save_filter(/* ... */) -> SaveFilter {
    todo!()
}

let mut app = App::new();
app.add_plugins((MinimalPlugins, SavePlugin))
    .add_systems(PreUpdate, save_with::<With<Save>, _, _>(save_filter).into_file("example.ron"));