Crate bevy_full_asset_path

Crate bevy_full_asset_path 

Source
Expand description

§bevy_full_asset_path

crates.io docs.rs

A tiny plugin that allows reading the full asset path of an asset loaded from disk

§Usage

Add FullAssetPathPlugin after DefaultPlugins, then use the FullAssetPathProvider resource to retrieve full paths:

use bevy::prelude::*;
use bevy_full_asset_path::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(FullAssetPathPlugin::default())
        .add_systems(Startup, setup)
        .run();
}

fn setup(asset_server: Res<AssetServer>, full_path_provider: Res<FullAssetPathProvider>) {
    let sprite: Handle<Image> = asset_server.load("bird/icon.png");
    let asset_path = sprite.path().unwrap();
    let full_path = full_path_provider.full_asset_path(asset_path).unwrap();
    info!("Full asset path: {}", full_path.display());
}

Modules§

prelude
Everything you need to get started.

Structs§

FullAssetPathPlugin
The plugin that allows access to FullAssetPathProvider on supported platforms.
FullAssetPathProvider
If we’re using a FileAssetReader to read an asset, this resource will tell us the full path used to load something from a given AssetPath.

Enums§

FullAssetPathError
Error returned by FullAssetPathProvider::full_asset_path.