1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//! Bevy plugin offering generic asset loaders for common file formats
//!
//! This library includes a collection of thin wrapper plugins around serde implementations for the
//! common file formats `json`, `ron`, `toml`, `yaml`, `MessagePack` and `xml`. Each plugin adds
//! an asset loader for a user type. Assets of that type will then be loaded from all files with
//! configurable extensions.
//!
//! The following example requires the `json` feature and loads a custom asset from a json file.
//! ```
//! use bevy::prelude::*;
//! use bevy::reflect::TypePath;
//! # /*
//! use bevy_common_assets::json::JsonAssetPlugin;
//! # */
//! # use bevy::app::AppExit;
//!
//! fn main() {
//! App::new()
//! # /*
//! .add_plugins((DefaultPlugins, JsonAssetPlugin::<Level>::new(&["level.json"])))
//! # */
//! # .add_plugins((MinimalPlugins, AssetPlugin::default()))
//! # .init_asset::<Level>()
//! .add_systems(Startup, load_level)
//! # .add_systems(Update, stop)
//! .run();
//! }
//!
//! fn load_level(mut commands: Commands, asset_server: Res<AssetServer>) {
//! let handle = LevelAsset(asset_server.load("trees.level.json"));
//! commands.insert_resource(handle);
//! }
//!
//! #[derive(serde::Deserialize, Asset, TypePath)]
//! struct Level {
//! positions: Vec<[f32; 3]>,
//! }
//!
//! #[derive(Resource)]
//! struct LevelAsset(Handle<Level>);
//!
//! # fn stop(mut events: MessageWriter<AppExit>) {
//! # events.write(AppExit::Success);
//! # }
//! ```
/// Module containing a Bevy plugin to load assets from `cbor` files with custom file extensions.
/// Module containing a Bevy plugin to load assets from `csv` files with custom file extensions.
/// Module containing a Bevy plugin to load assets from `json` files with custom file extensions.
/// Module containing a Bevy plugin to load assets from `MessagePack` files with custom file extensions.
/// Module containing a Bevy plugin to load assets from `postcard` files with custom file extensions.
/// Module containing a Bevy plugin to load assets from `ron` files with custom file extensions.
/// Module containing a Bevy plugin to load assets from `toml` files with custom file extensions.
/// Module containing a Bevy plugin to load assets from `xml` files with custom file extensions.
/// Module containing a Bevy plugin to load assets from `yaml` files with custom file extensions.
;