Skip to content

Commit

Permalink
async assets
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Nov 2, 2024
1 parent f3fed9f commit 9ffe000
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bevy-workshop/src/level/display.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Displaying the Level

Loading an asset is an asynchronous process. As it involves file or network access, it doesn't happen immediately. This is why the asset server is returning an [`Handle`](https://docs.rs/bevy/0.15.0-rc.2/bevy/asset/enum.Handle.html) instead of the data.

Accessing the data from the [`Assets<T>`](https://docs.rs/bevy/0.15.0-rc.2/bevy/asset/struct.Assets.html) resource returns an `Option<T>` as the data may not be present yet. In our case, we're using the 2 second delay of the splash screen to be sure that assets are done loading, so we can `unwrap()` the `Option`.

```rust
# extern crate bevy;
# use bevy::prelude::*;
Expand Down

0 comments on commit 9ffe000

Please sign in to comment.