NiklasEi / bevy_asset_loader

Bevy plugin helping with asset loading and organization
Apache License 2.0
459 stars 52 forks source link

Full example crashes at typed + mapped values #104

Closed janhohenheim closed 1 year ago

janhohenheim commented 1 year ago

When using both typed and mapped, a folder is expected to be of the form "foo/bar": https://github.com/NiklasEi/bevy_asset_loader/blob/9a7966c9e7a44026a2192292390b315d28c88ca7/bevy_asset_loader_derive/src/assets.rs#L156 ut the examples don't do this: https://github.com/NiklasEi/bevy_asset_loader/blob/9a7966c9e7a44026a2192292390b315d28c88ca7/bevy_asset_loader/examples/full_collection.rs#L48

As a side note, I cannot get the feature showcased in the linked line in the example to work at all in my projects. Does it currently work at all or am I simply missing something?

NiklasEi commented 1 year ago

The first line is acting on paths of the files inside the folder, which all have a path like folder/file. The example might have been broken because I hard-coded the file separator /. Could you try the example again, please? The mapped property is only available on main. It will be in the next release :slightly_smiling_face:

janhohenheim commented 1 year ago

The fix you propose can't address the cause since I am on macOS. With the current main, I still get the following error:

thread 'main' panicked at 'Should be a folder', bevy_asset_loader\examples/full_collection.rs:20:10

I am also using the main branch in my own tests, but for some reason I can only get the following form to work:

#[asset(paths("folder/file_a", "folder/file_b"), collection(typed, mapped))]

instead of the simpler:

#[asset(path("folder"), collection(typed, mapped))]
NiklasEi commented 1 year ago

Can you please verify that the issue is resolved on the latest main?

janhohenheim commented 1 year ago

Thanks for the fix! Getting the "Everything looks good!" message on main, testing a real world application now... Update: everything works 🎉