bevy_asset_loader
bevy_asset_loader copied to clipboard
Array syntax in RON dynamic collections?
Would it be possible to do something like this?
#[derive(AssetCollection)]
struct SpriteAnimationSequences {
// maybe this needs a new attribute?
// `collection(array)` or something,
// to distinguish from `Files`
#[asset(key = "anim.jumps", collection(typed)]
jumps: Vec<Handle<TextureAtlas>>,
}
({
// just use RON "array syntax"
// to list as many items as we need
"anim.jumps": [
TextureAtlas (
path: "jump_long.png",
tile_size_x: 24.,
tile_size_y: 32.,
columns: 16,
rows: 1,
),
TextureAtlas (
path: "jump_med.png",
tile_size_x: 24.,
tile_size_y: 32.,
columns: 12,
rows: 1,
),
TextureAtlas (
path: "jump_short.png",
tile_size_x: 24.,
tile_size_y: 32.,
columns: 8,
rows: 1,
),
],
})
I thought this would be easily implemented using an untagged enum with a Single
and a Vec
variant. But I ran into ron-rs/ron#217.