Bevy common assets
Collection of Bevy plugins offering generic asset loaders for common file formats.
Supported formats:
| format | feature | example |
|---|---|---|
json |
json |
json.rs |
msgpack |
msgpack |
msgpack.rs |
ron |
ron |
ron.rs |
toml |
toml |
toml.rs |
yaml |
yaml |
yaml.rs |
Usage
Enable the feature(s) for the format(s) that you want to use.
Define the types that you would like to load from files and derive serde::Deserialize and bevy::reflect::TypeUuid for them. The latter requires a unique uuid as an attribute:
// <-- keep me unique
With the types ready, you can start adding asset plugins. Every plugin gets the asset type that it is supposed to load as a generic parameter. You also need to configure custom file endings for each plugin:
use *;
use JsonAssetPlugin;
use MsgPackAssetPlugin;
use RonAssetPlugin;
use TomlAssetPlugin;
use YamlAssetPlugin;
The example above will load Level structs from json files ending on .json.level or .custom, from
ron files ending on .ron.level and so on...
See the examples for working Bevy apps using the different formats.
Compatible Bevy versions
The main branch is compatible with the latest Bevy release.
Compatibility of bevy_common_assets versions:
bevy_common_assets |
bevy |
|---|---|
0.4 |
0.9 |
0.3 |
0.8 |
0.1 - 0.2 |
0.7 |
main |
0.9 |
bevy_main |
main |
License
Dual-licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.