Skip to content

Add a test to check that we're only launching one load task when loading subassets.#20449

Draft
andriyDev wants to merge 2 commits intobevyengine:mainfrom
andriyDev:fix-multiple-loads-3
Draft

Add a test to check that we're only launching one load task when loading subassets.#20449
andriyDev wants to merge 2 commits intobevyengine:mainfrom
andriyDev:fix-multiple-loads-3

Conversation

@andriyDev
Copy link
Copy Markdown
Contributor

@andriyDev andriyDev commented Aug 7, 2025

Objective

Solution

  • Count the number of loads for a root asset that are currently happening. Note this needs to count assets by path and type ID, since you could be loading an asset path multiple times with different types.
  • Don't launch a new load for a root asset if its number of loads is positive.
  • Add some special handling for load_untyped_async to allow it to load even if the number of loads is already positive (since we need the handle, which means awaiting the async task which needs to perform the actual load).

Testing

  • Added a test to check that we only launch one task.
    • This test is brittle. We don't have any way to count how many tasks are currently running, so the best we can do is just hope the tasks finish quickly and stall until they are done.
  • Ran the many_foxes example and it now works correctly!

@andriyDev andriyDev added C-Bug An unexpected or incorrect behavior A-Assets Load files from disk to use for things like images, models, and sounds D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 7, 2025
@andriyDev andriyDev marked this pull request as ready for review August 7, 2025 08:05
@andriyDev andriyDev marked this pull request as draft August 7, 2025 08:09
@andriyDev andriyDev removed the S-Needs-Review Needs reviewer attention (from anyone!) to move forward label Aug 7, 2025
@eira-fransham
Copy link
Copy Markdown
Contributor

eira-fransham commented Oct 14, 2025

It's a shame that this went stale, this is a really irritating bug for me.

EDIT: I locally merged this into the release-0.17.2 branch and it appears to have fixed my issue. There seems to be some other kind of strange issue going on, but the behaviour is much less glitchy than it was. I'm going to assume that the remaining issues are in my code.

@cart cart added this to Assets Feb 12, 2026
@github-project-automation github-project-automation bot moved this to Needs SME Triage in Assets Feb 12, 2026
eira-fransham pushed a commit to eira-fransham/bevy that referenced this pull request Feb 13, 2026
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-Bug An unexpected or incorrect behavior D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

Loading an asset and one of its subassets causes two loads of the same asset to occur. many_foxes and other animation examples have stopped working

3 participants