Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset v2: Asset path serialization fix #9756

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions crates/bevy_asset/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,10 @@ pub struct StrongHandle {

impl Drop for StrongHandle {
fn drop(&mut self) {
if let Err(err) = self.drop_sender.send(DropEvent {
let _ = self.drop_sender.send(DropEvent {
id: self.id.internal(),
asset_server_managed: self.asset_server_managed,
}) {
println!("Failed to send DropEvent for StrongHandle {:?}", err);
}
});
}
}

Expand Down
1 change: 1 addition & 0 deletions crates/bevy_asset/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub use reflect::*;
pub use server::*;

pub use anyhow;
pub use bevy_utils::BoxedFuture;

use crate::{
io::{processor_gated::ProcessorGatedReader, AssetProvider, AssetProviders},
Expand Down
9 changes: 3 additions & 6 deletions crates/bevy_asset/src/path.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
use bevy_utils::CowArc;
use serde::{de::Visitor, ser::SerializeTupleStruct, Deserialize, Serialize};
use serde::{de::Visitor, Deserialize, Serialize};
use std::{
fmt::{Debug, Display},
hash::Hash,
Expand Down Expand Up @@ -231,10 +231,7 @@ impl<'a> Serialize for AssetPath<'a> {
where
S: serde::Serializer,
{
let mut state = serializer.serialize_tuple_struct("AssetPath", 1)?;
let string = self.to_string();
state.serialize_field(&string)?;
state.end()
self.to_string().serialize(serializer)
}
}

Expand All @@ -243,7 +240,7 @@ impl<'de> Deserialize<'de> for AssetPath<'static> {
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_tuple_struct("AssetPath", 1, AssetPathVisitor)
deserializer.deserialize_string(AssetPathVisitor)
}
}

Expand Down