vleue / bevy_embedded_assets Goto Github PK
View Code? Open in Web Editor NEWBevy plugin to embed assets in your game
Bevy plugin to embed assets in your game
If some conditions are met:
then the aforementioned assets won't load.
assets/foo/bar.png
)asset_server.load("foo/bar.png")
)Assets being actually loaded.
Apparently Path
s do not convert forward slashes into backward ones in Wasm builds, which is the cause of the problem.
I think using backslashes won't fix the problem: it will break on Linux/MacOS instead (I haven't tested it, but I assume backslashes won't be converted into forward slashes on these platforms).
This is inconvenient since it hinders cross-platform development.
Hello,
I have a workspace with the following structure :
client
| assets
server
| assets
But when I run/build one crate or the other, I have this error :
warning: Could not find the asset folder from the Cargo build directory
warning: Could not find asset folder, please specify its path with $BEVY_ASSET_PATH
error: failed to run custom build command forbevy_embedded_assets v0.4.0
I managed to fix the issue by copying/pasting my asset folders at the root level, but duplicating assets isn't an ideal solution.
This issue appeared right after I split my project into multiple crates.
If you need more information, I would be glad to help!
I'm trying to load a image from Drag-and-Drop, but with this plugin enabled, system reports cannot find file with absolute path.
Any walk around?
Custom shaders doesn't works with this plugin.
1 error[E0277]: the trait bound `bevy_embedded_assets::EmbeddedAssetPlugin: bevy::prelude::Plugin` is not satisfied
--> src/main.rs:11:60
|
11 | .add_before::<bevy::asset::AssetPlugin, _>(EmbeddedAssetPlugin),
| ---------- ^^^^^^^^^^^^^^^^^^^ the trait `bevy::prelude::Plugin` is not implemented for `bevy_embedded_assets::EmbeddedAssetPlugin`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `bevy::prelude::Plugin`:
bevy::a11y::AccessibilityPlugin
bevy::app::ScheduleRunnerPlugin
bevy::asset::diagnostic::AssetCountDiagnosticsPlugin<T>
bevy::audio::AudioPlugin
bevy::core_pipeline::CorePipelinePlugin
bevy::core_pipeline::blit::BlitPlugin
bevy::core_pipeline::bloom::BloomPlugin
bevy::core_pipeline::core_2d::Core2dPlugin
and 62 others
note: required by a bound in `bevy::app::PluginGroupBuilder::add_before`
--> /home/freyja-moth/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_app-0.10.1/src/plugin_group.rs:124:42
|
124 | pub fn add_before<Target: Plugin, T: Plugin>(mut self, plugin: T) -> Self {
| ^^^^^^ required by this bound in `PluginGroupBuilder::add_before`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `game` (bin "game" test) due to previous error
You know I really have no idea how I got into this situation.
This is my current code, which is almost identical to the example given
pub mod prelude;
pub mod state;
use prelude::*;
fn main() {
App::new()
.add_plugins(
DefaultPlugins
.build()
.add_before::<bevy::asset::AssetPlugin, _>(EmbeddedAssetPlugin),
)
.add_plugins(GamePlugins)
.run()
}
Paths on Windows that use backslashes are not properly escaped and result in invalid codegen.
.cargo/config.toml
in project folder with (expects assets
to also be in project root)
[env]
BEVY_ASSET_PATH = { relative = true, value = "assets" }
target/debug/build/bevy_embedded_assets_HASH/out/include_all_assets.rs
/// Generated function that will add all assets to the [`EmbeddedAssetIo`].
#[allow(unused_variables)] pub fn include_all_assets(embedded: &mut EmbeddedAssetIo){
embedded.add_asset(std::path::Path::new("face.blend"), include_bytes!("path\prefix\assets\myAsset.ext"));
Paths with backslashes should have the backslashes escaped.
Example expected output:
/// Generated function that will add all assets to the [`EmbeddedAssetIo`].
#[allow(unused_variables)] pub fn include_all_assets(embedded: &mut EmbeddedAssetIo){
embedded.add_asset(std::path::Path::new("face.blend"), include_bytes!("path\\prefix\\assets\\myAsset.ext"));
It looks like Bevy 0.12 includes some support for embedded assets: https://bevyengine.org/news/bevy-0-12/#embedded-assets
That said, this crate has been working great for me, and I'm having trouble trying to get the Bevy 0.12 embedded assets working as a replacement. Should/can this crate be updated to support Bevy 0.12, or should we switch to using Bevy itself for embedded assets?
I'm trying to setup a build process using cross-rs. Unfortunately, I have to manually specificy the BEVY_ASSET_PATH
before the command. Also unfortunately, it's ran in a docker container so an absolute path is unhelpful. If I pass in BEVY_ASSET_PATH=./assets
then this mod tries to load assets from its example dir (which doesn't exist). You can reproduce this now by running BEVY_ASSET_PATH=./assets cargo run
and seeing the error outputs from bevy_embedded_assets
.
I propose either 2 solutions.
1 - make the env var of BEVY_ASSET_PATH
relative to the cargo workspace root
2 - default the value of BEVY_ASSET_PATH
to be the root of the project with /assets (as that's the bevy default)
bevy="0.7.0"
bevy_embedded_assets="0.3.0"
stable toolchain
Rust analyzer gives an error "rust-analyzer failed to run build scripts Check the server logs for additional info." and VSCode plugin turns yellowish-brown
Which platforms are supported by this plugin?
I am wondering how to modify https://github.com/bevyengine/bevy_github_ci_template release workflow to exclude the assets since I am using this plugin to embed them in the binary.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.