Skip to content

Conversation

Aqaao
Copy link

@Aqaao Aqaao commented Aug 2, 2025

allow load assets with source, like embedded asset.

embedded_asset!(app, "path/ui.libgdx.atlas");
embedded_asset!(app, "path/ui.libgdx.png");

asset_server.load("embedded://create/mod/path/ui.libgdx.atlas")

@extrawurst
Copy link
Contributor

Oh thats awesome! Could you provide one example that makes use of that please

@Aqaao
Copy link
Author

Aqaao commented Aug 9, 2025

Oh thats awesome! Could you provide one example that makes use of that please

added.

Copy link
Contributor

@extrawurst extrawurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we need new assets for this example, we can just use the existing ones and actually lets animate like in the original example

@Aqaao
Copy link
Author

Aqaao commented Aug 14, 2025

I dont think we need new assets for this example, we can just use the existing ones and actually lets animate like in the original example

I think so too ,but I must copy the existing assets into example folder, because embedded_assets marco only use relative paths, and directly embedding file from assets folder via a relative path will result in generated asset paths that are perplexing.

// call embedded macro in /examples/some_example.rs
embedded_asset!(app, "examples", "../assets/animation_sheet.libgdx.atlas");
embedded_asset!(app, "examples", "../assets/animation_sheet.png");
// generated asset path
asset_server.load("embedded://../assets/animation_sheet.libgdx.atlas")
// if you call embedded macro in /src/some_dir/some_file.rs, it will be even worse.
asset_server.load("embedded://workspace/../../assets/animation_sheet.libgdx.atlas")

That’s also why I didn’t add the example — nobody would use embedded_asset!() in a game development environment. I use bevy_embedded_assets to embed the assets folder, and it creates readable asset paths for me.

I think the best is to just mention in the documentation that asset source works. Adding a confusing example would only make people more puzzled.

@extrawurst
Copy link
Contributor

I think the best is to just mention in the documentation that asset source works. Adding a confusing example would only make people more puzzled.

sounds good to me. can you add that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants