Function moonshine_save::load::load_from_file
source · pub fn load_from_file(path: impl Into<PathBuf>) -> LoadPipeline
Expand description
Default LoadPipeline
.
§Usage
This pipeline tries to load all saved entities from a file at given path
. If successful, it
despawns all entities marked with Unload
(recursively) and spawns the loaded entities.
Typically, it should be used with run_if
.
§Example
use bevy::prelude::*;
use moonshine_save::prelude::*;
let mut app = App::new();
app.add_plugins(LoadPlugin)
.add_systems(PreUpdate, load_from_file("example.ron").run_if(should_load));
fn should_load() -> bool {
todo!()
}