1 unstable release
new 0.1.0 | Feb 26, 2025 |
---|
#1589 in Game dev
Used in bevy_gaussian_splatting
33KB
154 lines
bevy_file_asset 🧩
bevy asset loader supporting files outside of the asset folder
minimal example
use bevy::prelude::*;
use bevy_file_asset::FileAssetPlugin;
fn main() {
App::new()
.add_plugins((
FileAssetPlugin,
DefaultPlugins,
))
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2d::default());
let image = asset_server.load("file://docs/image.png");
commands.spawn(Sprite {
image,
..Default::default()
});
}
compatible bevy versions
bevy_args |
bevy |
---|---|
0.1 |
0.15 |
lib.rs
:
File Asset Plugin for Bevy
This plugin registers an asset source under the "file"
scheme which loads assets
directly from arbitrary paths (both relative to the working directory and absolute).
If the file does not exist at the given path, the reader returns a NotFound
error,
so that Bevy’s asset server can fall back to other methods.
Example Usage
use bevy::prelude::*;
use bevy_file_asset::FileAssetPlugin;
let mut app = App::new();
// Register the file asset source before adding the DefaultPlugins.
app.add_plugins((FileAssetPlugin::default(), DefaultPlugins));
Dependencies
~63–100MB
~2M SLoC