bevyengine / bevyengine/bevy-website
AssetReader is missing in the upgrade guides
- Dominant language
- JavaScript
- Stars
- 249
- Forks
- 450
- Avg merge
- 16h 20m
- Merged PRs (30d)
- 6
Description
## How can Bevy's documentation be improved?
in any of the following (not sure which)
https://bevyengine.org/learn/migration-guides/0-10-to-0-11/
https://bevyengine.org/learn/migration-guides/0-11-to-0-12/
https://bevyengine.org/learn/migration-guides/0-12-to-0-13/
there is missing the 'AssetReader'
It was completely changed since 0.10.0
See here: https://bevyengine.org/examples/Assets/custom-asset-reader/
formerly it was called AssetIo
Also the signature of the read function changed:
```
xpected `{async block@src\asset_server_plugin.rs:53:23: 66:5}` to be a future that resolves to `Result, AssetReaderError>`, but it resolves to `Result, AssetReaderError>`
```
It is now in WASM the same as in non-WASM
Sorry if I ask, but it took me 3 weeks to get this implemented. I am relatively new to rust and had too read into assosiated types, Send, async, Pin, move, Futures, Javascript closures, the whole bindgen and web-assembly topics
If there is someone who can help me how I adopt my read function in `impl AssetReader for CustomAssetReader`:
```
fn read<'a>(&'a self,path: &'a Path) -> BoxedFuture<'a, Result>, AssetReaderError>> {
// if we are on wasm then get asset by ID from asset server
#[cfg(target_arch = "wasm32")] {
let result = load_asset(path);
let res = Box::pin(async move {
// Call the asynchronous function directly
let result = result.await;
result.map(|data| {
let d = data.unwrap_or_else(|| Vec::::new());
log::info!("unwrapped: {}", data_to_string(&d));
d
}) // Handle None case if needed
.map_err(|error| {
log::info!("map-error!!!!!!!! {:?}", error);
AssetReaderError::NotFound(path_str.into())
}) });
return res;
}
```
This worked in bevy 0.10.0 (with the old function name of course)
It now gives me the above error, so I understand that it (something) has to implement "AsyncRead + Send + Sync + Unpin". But I don't know how. Back then I asked on the discord server but never got any anwer
Contributor guide
Research direction
Review the three linked migration guides and the custom asset reader example, comparing the former AssetIo API with AssetReader and its changed read signature. Document the relevant upgrade path, including the WASM and non-WASM behavior, so readers can identify the correct guide and understand the required API changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100