Expand description
Automatic persistence for Bevy resources with change detection.
This crate provides automatic saving and loading of Bevy resources, with support for multiple serialization formats and change detection.
§Features
- Automatic Save/Load: Resources are automatically saved when modified and loaded on startup
- Multiple Formats: Support for JSON and RON serialization formats
- Change Detection: Only saves when resources actually change, minimizing disk I/O
- Derive Macro: Simple
#[derive(Persist)]
to make any resource persistent - Flexible Configuration: Customize save paths, formats, and save strategies per resource
§Quick Start
ⓘ
use bevy::prelude::*;
use bevy_persist::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Resource, Default, Serialize, Deserialize, Persist)]
struct Settings {
volume: f32,
difficulty: String,
}
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(PersistPlugin::default())
.init_resource::<Settings>()
.run();
}
Re-exports§
pub use inventory;
Modules§
Structs§
- Persist
Data - Data structure for persisting parameter values.
- Persist
File - Complete persistence file format.
- Persist
Manager - Resource that manages persistence.
- Persist
Plugin - Plugin for automatic persistence.
- Persist
Registration - Registration data for auto-discovered Persist types.
Enums§
- Persist
Error - Errors that can occur during persistence operations
- Persist
Mode - Persistence mode for a resource
Traits§
- Persistable
- Trait for types that can be persisted.
Functions§
- load_
persisted - Load persisted values on startup
- persist_
system - Generic system to persist a resource when it changes
- register_
persist_ type - Register a Persist type with the system.
Type Aliases§
- Persist
Result - Result type for persistence operations