Skip to content

Replace the load_folder API by load_batch #19760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

shishanyue
Copy link

Objective

About #19727

Solution

  • Remove load_folder API,LoadedFolder and so on
  • add LoadedBatch ,LoadBatchRequest
  • use the crate glob

Testing

-rewrite the example texture_atlas.rs

//before
// Load multiple, individual sprites from a folder
commands.insert_resource(RpgSpriteFolder(asset_server.load_folder("textures/rpg")));

//now
commands.insert_resource(RpgSpriteFolder(asset_server.load_batch(
    LoadBatchRequest::new(vec!["textures/rpg/**/*", "textures/rpg/chars/**/*"]),
)));

Problem

But there have a problem.I can't get the base path.I need in load_batch_internal to glob the all file.

format!("assets/{}", request_path)

How can I obtain the unprocessed_path and processed_path under load_batch? I have used the crate glob. If I want to use it, I must prepend 'assets' to the path. However, it is evident that we can change it, and even add additional paths like in extra_file. Therefore, I need to retrieve the corresponding full path through AssetPath in load_batch. But I cannot find any method to achieve this.

@greeble-dev greeble-dev added C-Feature A new feature, making something new possible A-Assets Load files from disk to use for things like images, models, and sounds M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Help The author needs help finishing this PR. labels Jun 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Needs-Help The author needs help finishing this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants