Bevy-Embasset
Embed your asset folder inside your binary.
bevy-embasset adds support for loading assets embedded into the binary.
Furthermore, it can optionally try to load assets via the default AssetPlugin
first, thereby allowing the embedded assets to be used as fallbacks in case of problems.
As icing on the cake, bevy-embasset allows to register multiple other
AssetServer's, that will be used for asset paths beginning with
specific configurable strings. This can be used to have some assets load from e.g. a web-service,
while others are loaded from disk or embedded in the binary. It can also be used to e.g. build
1 or more sub-crates each using EmbassetIo and holding a set of assets - thereby
saving compile-time as the assets don't have to be compiled every time (An example of this, can be found in the
game bevoids).
Usage
If you are using the DefaultPlugins group from Bevy, it can
easily be added this way:
use ;
use AddEmbassetPlugin;
The add_embasset_assets function can be generated by a build script (build.rs):
use ;
and included in the source:
include!;
For the build script, the feature build needs to be enabled:
[]
= { = "*", = ["build"] }
Features
use_default_assetio
Try to use Bevy's default AssetIo for handling assets first. In case this fails,
attempt to use the embedded resources.
build
Needs to be enabled in order to get access to the include_XXX methods, needed from build.rs to
automatically include assets in the binary.
Bevy Compatibility
| Bevy | bevy-embasset |
|---|---|
| 0.6 | main |