Function moonshine_save::save::save_all_with

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

Creates a DynamicSavePipelineBuilder which saves all entities unconditionally and a filter source S.

Additionally, any valid system which returns a SaveFilter may be used as a filter source S.

§Warning

Be careful about using this builder as some entities and/or components may not be safely serializable.

§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_all_with(save_filter).into_file("example.ron"));