Open emosenkis opened 4 years ago
I published a little crate that supports inline assets using only Bevy's public API (as of the current latest commit, at least): bevy_prototype_inline_assets
. You can see it in action in budgers (WIP).
include_str! for shaders would be nice too. - update: https://github.com/bevyengine/bevy/blob/92ba6224b9b66eb779683603e7022e421511dfe5/crates/bevy_asset/src/assets.rs#L388 looks good for shaders.
What's the difference between the proposed solution and load_internal_asset!
? It sounds like the requested feature now exists in bevy.
load_internal_asset
depends on the asset loader exposing a usable API, which it doesn't have too. For example it's not possible to use with the gltf loader
The code that loads a PNG file into a Texture seems to be tightly coupled with the AssetServer's system for loading from the filesystem. It would be good to be able to use
include_bytes!
to bundle the file content but still take advantage of Bevy's support for loading assets of various types. It would be sufficient to add a method such as:or even: