Fix missing asset info path for synchronous loading (#486)

This commit is contained in:
Ilja Kartašov 2020-09-14 23:14:54 +02:00 committed by GitHub
parent b0e64d4295
commit b3e339e58a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -258,12 +258,15 @@ impl AssetServer {
.to_str()
.expect("extension should be a valid string"),
) {
let mut asset_info_paths = self.asset_info_paths.write();
let handle_id = HandleId::new();
let resources = &self.loaders[*index];
let loader = resources.get::<Box<dyn AssetLoader<T>>>().unwrap();
let asset = loader.load_from_file(path)?;
let handle = Handle::from(handle_id);
assets.set(handle, asset);
asset_info_paths.insert(path.to_owned(), handle_id);
Ok(handle)
} else {
Err(AssetServerError::MissingAssetHandler)