-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Scene Serialization dropping Sprite Component #3746
Comments
FWIW - I see in I.e. - this line sets
|
If I change sprite.rs as follows to add the
Without ignoring
|
I had the same problem. but no need Is it necessary to add |
I want use bevy/crates/bevy_pbr/src/light.rs Lines 358 to 369 in d51a87c
bevy/crates/bevy_pbr/src/render/light.rs Lines 48 to 59 in d51a87c
bevy/crates/bevy_pbr/src/render/light.rs Lines 61 to 70 in d51a87c
bevy/crates/bevy_pbr/src/render/light.rs Lines 383 to 394 in d51a87c
bevy/crates/bevy_pbr/src/render/light.rs Lines 573 to 595 in d51a87c
bevy/crates/bevy_pbr/src/render/light.rs Lines 625 to 640 in d51a87c
bevy/crates/bevy_pbr/src/render/light.rs Lines 1103 to 1108 in d51a87c
bevy/crates/bevy_pbr/src/render/mesh.rs Lines 90 to 95 in d51a87c
bevy/crates/bevy_pbr/src/render/mesh.rs Lines 184 to 192 in d51a87c
|
I just ran into the same thing. |
As a workaround, adding this to my app allowed me to save and load scenes with Sprites on Bevy 0.9.0: app
.register_type::<Cow<'static, str>>()
.register_type::<Anchor>()
.register_type::<Option<Rect>>()
.register_type::<Option<Vec2>>()
.register_type_data::<Option<Vec2>, ReflectSerialize>()
.register_type_data::<Option<Vec2>, ReflectDeserialize>()
.register_type_data::<Sprite, ReflectComponent>()
.register_type::<Sprite>() I think some of these have already been added on main but I know I think before 0.9.0 this might have been held up by enum reflection being not fully supported. I would think a PR would be appreciated and should be fairly easy now if you still want to go for it. Would just need to add |
Bevy version
0.6.0
Operating system & version
Ubuntu 20.04
What you did
I tried to use the scene.rs example code to serialize and load a scene which had entities with the Sprite component. On load (after calling world.clear_entities) the Sprite component was missing off of the entity and the Image Handle was missing its reference.
What you expected to happen
Saving and loading the scene should result in no change
What actually happened
The sprite becomes invisible as its component is missing
Additional information
Here is a repo showing the bug (saving is mapped to P and loading is mapped to L on the keyboard), loading multiple times seems to make the image handle find the image on alternating loads.
https://github.com/mwbryant/weird_loading_bug
This also happens with TextureAtlasSprite and when using binary serialization techniques.
The text was updated successfully, but these errors were encountered: