Module moonshine_save::save

source ·
Expand description

Elements related to saving world state.

§Example

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

#[derive(Component, Default, Reflect)]
#[reflect(Component)]
struct Data(u32);

let mut app = App::new();
app.add_plugins((MinimalPlugins, SavePlugin))
    .register_type::<Data>()
    .add_systems(PreUpdate, save_default().into_file("example.ron"));

app.world.spawn((Data(12), Save));
app.update();

let data = std::fs::read_to_string("example.ron").unwrap();

Structs§

Enums§

Traits§

  • Any type which may be used to trigger [save_into_file_on_request] or [save_into_file_on_event].

Functions§

Type Aliases§