Skip to content

add asset source support#10

Open
Aqaao wants to merge 4 commits into
rustunit:mainfrom
Aqaao:source_support
Open

add asset source support#10
Aqaao wants to merge 4 commits into
rustunit:mainfrom
Aqaao:source_support

Conversation

@Aqaao

@Aqaao Aqaao commented Aug 2, 2025

Copy link
Copy Markdown

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
Copy Markdown
Contributor

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

@Aqaao

Aqaao commented Aug 9, 2025

Copy link
Copy Markdown
Author

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

added.

@extrawurst extrawurst left a comment

Copy link
Copy Markdown
Contributor

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

Aqaao commented Aug 14, 2025

Copy link
Copy Markdown
Author

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
Copy Markdown
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?

@Aqaao

Aqaao commented Oct 28, 2025

Copy link
Copy Markdown
Author

sounds good to me. can you add that?

sorry for the delay

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