You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an LDTK project using external levels that has 34 levels. When I load a project file and select a level, process_ldtk_levels will sometimes fail to load the level. Inspecting the size of Assets<LdtkLevel> will show between 22 and 31.
What seems to be happening is that when the LdtkProject asset gets loaded it creates all the handles for the external levels, but loading asset dependencies isn't guaranteed to happen all at once. Since process_ldtk_levels is triggered by the creation of the handle, it's possible that your level just isn't there.
I was able to make a rough fix on my fork here by letting process_ldtk_levels run until the number of assets loaded matches the number of external files listed in a project.
Seeing as how Assets v2 is already in bevy's main branch, this might not be worth fixing at this exact moment.
The text was updated successfully, but these errors were encountered:
Hmm for some reason I was under the impression that AssetEvent::Created wouldn't fire for the parent asset until it and its dependencies were all loaded. I suppose that is not the case.
I was able to make a rough fix on my fork here by letting process_ldtk_levels run until the number of assets loaded matches the number of external files listed in a project.
An interesting idea. One thing I'd experiment with too is listening to the LdtkLevel asset events in addition to filtering for Added<Handle<LdtkLevel>>. Could maybe make a run condition for it.
Seeing as how Assets v2 is already in bevy's main branch, this might not be worth fixing at this exact moment.
I'm actually making a lot of changes to the asset types right now too, should be at a stopping point there soon.
…ely loaded (#281)
Fixes#232
Added a check so that when applying `LevelSelection`, there's a check to
make sure the external level is loaded.
Works for my game and all tests pass, not sure if this has any weird
knock-on effects.
I have an LDTK project using external levels that has 34 levels. When I load a project file and select a level,
process_ldtk_levels
will sometimes fail to load the level. Inspecting the size ofAssets<LdtkLevel>
will show between 22 and 31.What seems to be happening is that when the
LdtkProject
asset gets loaded it creates all the handles for the external levels, but loading asset dependencies isn't guaranteed to happen all at once. Sinceprocess_ldtk_levels
is triggered by the creation of the handle, it's possible that your level just isn't there.I was able to make a rough fix on my fork here by letting
process_ldtk_levels
run until the number of assets loaded matches the number of external files listed in a project.Seeing as how Assets v2 is already in bevy's main branch, this might not be worth fixing at this exact moment.
The text was updated successfully, but these errors were encountered: