From 9ffe000ae74fb9ebd1cf373594da5085389850ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 3 Nov 2024 00:02:26 +0100 Subject: [PATCH] async assets --- bevy-workshop/src/level/display.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bevy-workshop/src/level/display.md b/bevy-workshop/src/level/display.md index 6d1fb41..3217b22 100644 --- a/bevy-workshop/src/level/display.md +++ b/bevy-workshop/src/level/display.md @@ -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`](https://docs.rs/bevy/0.15.0-rc.2/bevy/asset/struct.Assets.html) resource returns an `Option` 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::*;