#assets #bevy-plugin #bevy #asset-manager #single-file

bevy_asset_packer

Easy to use bevy plugin for packing resources in single file and protect him

4 releases (breaking)

0.4.0 Aug 19, 2023
0.3.0 Aug 11, 2023
0.2.0 Aug 10, 2023
0.1.0 Aug 10, 2023

#1571 in Game dev

41 downloads per month

BSD-3-Clause

23KB
446 lines

Bevy asset packer

Easy to use bevy plugin for packing resources in single file and protect him.

Features

  • Paking all assets in single file.
  • Encrypt assets.
  • Compressing assets.
  • Load from externel bundle.

Usage

Dependency

Add to Cargo.toml:

[build-dependencies]
bevy_asset_packer = "0.4.0"

[dependencies]
bevy_asset_packer = "0.4.0"

System setup

In src/main.rs

fn main() {
    let mut options = AssetBundlingOptions::default();
    options.encode_file_names = true;
    options.compress_on = true;
    options.set_encryption_key([57, 206, 200, 7, 215, 17, 45, 219, 131, 171, 8, 214, 85, 12, 129, 176]);

    App::new()
        .add_plugins(
            DefaultPlugins
                .build()
                .add_before::<bevy::asset::AssetPlugin, _>(BundledAssetIoPlugin::from(options)),
        )
        .run();
}

In build.rs

fn main() {
    let mut options = AssetBundlingOptions::default();
    options.encode_file_names = true;
    options.compress_on = true;
    options.set_encryption_key([57, 206, 200, 7, 215, 17, 45, 219, 131, 171, 8, 214, 85, 12, 129, 176]);
    AssetBundler::from(options).build().unwrap();
}

You can see examle in example folder.
And its all!!!

Dependencies

~20–57MB
~1M SLoC