bevy_track_asset 0.1.0

A Bevy plugin for tracking assets with Bevy's change detection.
Documentation

Bevy Track Asset

MIT/Apache 2.0 CI docs.rs Deps.rs Crate Dependencies (specific version)

Utility for propagating asset reloads to dependent ECS data.

When an asset is modified or finishes loading, all components/resources that depend on it are automatically marked as changed so systems can react using standard Bevy change detection.

Install

[dependencies]

bevy_track_asset = "0.1"

Quick Start

use bevy::prelude::*;
use bevy_track_asset::prelude::*;

fn main() {
    App::new()
        .add_plugins((
            DefaultPlugins,
            AssetTrackingPlugin::<PostUpdate>::default(),
        ));
}

Implement AssetDependent for your data:

impl AssetDependent<MyAsset> for MyComponent {
    fn asset_id(&self) -> AssetId<MyAsset> {
        self.handle.id()
    }
}

Then register tracking:

app.add_plugins(
    TrackAssetPlugin::<MyAsset, Query<&mut MyComponent>>::default()
);

React using normal change detection:

fn system(query: Query<&MyComponent, Changed<MyComponent>>) {
    // recompute derived data
}

Docs

Full usage and advanced patterns, like custom system params, are exhaustively documented at docs.rs/bevy_track_asset.

Roadmap

  • Derive AssetDependent: Macro for deriving AssetDependent implementations for structs with Handle<T> fields, reducing boilerplate and potential for errors.