bevy/crates/bevy_reflect/src/serde
Gino Valente 4e2374334f bevy_reflect: Fix binary deserialization not working for unit structs (#6722)
# Objective 

Fixes #6713

Binary deserialization is failing for unit structs as well as structs with all ignored/skipped fields.

## Solution

Add a check for the number of possible fields in a struct before deserializing. If empty, don't attempt to deserialize any fields (as there will be none).

Note: ~~This does not apply to enums as they do not properly handle skipped fields (see #6721).~~ Enums still do not properly handle skipped fields, but I decided to include the logic for it anyways to account for `#[reflect(ignore)]`'d fields in the meantime.

---

## Changelog

- Fix bug where deserializing unit structs would fail for non-self-describing formats
2022-11-23 00:01:36 +00:00
..
de.rs bevy_reflect: Fix binary deserialization not working for unit structs (#6722) 2022-11-23 00:01:36 +00:00
mod.rs bevy_reflect: Improve serialization format even more (#5723) 2022-09-20 19:38:18 +00:00
ser.rs bevy_reflect: Fix binary deserialization not working for unit structs (#6722) 2022-11-23 00:01:36 +00:00
type_data.rs bevy_reflect: Improve serialization format even more (#5723) 2022-09-20 19:38:18 +00:00