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

Can't deserialize scene #9947

Open
HaNaK0 opened this issue Sep 28, 2023 · 2 comments
Open

Can't deserialize scene #9947

HaNaK0 opened this issue Sep 28, 2023 · 2 comments
Labels
A-Scenes Serialized ECS data stored on the disk C-Bug An unexpected or incorrect behavior

Comments

@HaNaK0
Copy link
Contributor

HaNaK0 commented Sep 28, 2023

Bevy version

0.11.2 & 0.11.3

What you did

I have serialized a dynamic scene and now I try to desrialize it

What went wrong

I hope there to be entities loaded in preferably with sprites but the world is empty whcih i verify by serializing the scene again

Additional information

The warning I get is 2023-09-28T07:36:55.657629Z WARN bevy_asset::asset_server: encountered an error while loading an asset: no registration found for type `core::option::Option<glam::f32::vec2::Vec2>` at scenes/scene.scn:52:22

The part from scenes/scene.scn the warning is referencing
Skärmbild 2023-09-28 094751

@HaNaK0 HaNaK0 added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Sep 28, 2023
@alice-i-cecile alice-i-cecile added A-Assets Load files from disk to use for things like images, models, and sounds A-Scenes Serialized ECS data stored on the disk and removed S-Needs-Triage This issue needs to be labelled A-Assets Load files from disk to use for things like images, models, and sounds labels Sep 28, 2023
@66OJ66
Copy link
Contributor

66OJ66 commented Oct 4, 2023

In order to deserialize a scene, each of the types in that scene need to have been registered.
Most Bevy types are registered automatically, but it looks like Option<Vec2>> isn't.

So to fix this, you just need to register that missing type in your app
e.g.

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        // Include this
        .register_type::<Option<Vec2>>()
        .run();
}

Hope this helps!

@HaNaK0
Copy link
Contributor Author

HaNaK0 commented Oct 5, 2023

Ok, so it's possible to register types you haven't created.
But Option<Vec2>> maybe should be registered? Seems like a common usecase to store transforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Scenes Serialized ECS data stored on the disk C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

4 participants
@alice-i-cecile @HaNaK0 @66OJ66 and others