Open
Description
What problem does this solve or what need does it fill?
Currently, it seems like the simplest way to set the default value of an Assets
collection is this:
fn load_default_font(mut fonts: ResMut<Assets<Font>>) {
let bytes = include_bytes!("font.ttf");
let font = Font::try_from_bytes(bytes.to_vec()).unwrap();
fonts.insert(AssetId::<Font>::DEFAULT_UUID, font);
}
This sidesteps the whole asset system, and requires including potentially large data in the binary (in my case, a 14 MiB font file), so it's not ideal.
AssetServer
has no methods that load an asset into an existing Handle
/AssetId
, so it cannot directly be used for this. It's possible to load the asset with a different Handle
, listen to the asset event that indicates it has loaded, and then copy the asset over to the default ID. This is extremely inconvenient, though.
What solution would you like?
AssetServer
should expose some way of asynchronously loading an asset into an existing Handle
or AssetId
, overwriting whatever is already there.
What alternative(s) have you considered?
None so far. Open to suggestions.