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

Unable to deserialize tileRectsIds that's null #300

Open
przemykomo opened this issue Feb 13, 2024 · 2 comments
Open

Unable to deserialize tileRectsIds that's null #300

przemykomo opened this issue Feb 13, 2024 · 2 comments

Comments

@przemykomo
Copy link

In the documentation it's stated as only used by the editor so I don't think this library should even try to parse it.
It fails in my project because of this null which was saved by the ldtk:

ERROR bevy_asset::server: Failed to load asset 'gamemap.ldtk' with asset loader 'bevy_ecs_ldtk::assets::ldtk_project::LdtkProjectLoader': unable to deserialize LDtk project: invalid type: null, expected i32 at line 932 column 13

Using bevy v0.12.1, bevy_ecs_ldtk v0.9.0 and ldtk v1.5.3.

@przemykomo
Copy link
Author

Apparently this can be fixed by simply changing this line:

pub tile_rects_ids: Vec<Vec<i32>>,

into:

pub tile_rects_ids: Vec<Vec<Option<i32>>>,

Not quite sure whether this fix breaks anything else, I simply cloned this repo, changed this line and used the local copy as a dependency in my project.

@Trouv
Copy link
Owner

Trouv commented Mar 17, 2024

Thanks for bringing this to my attention.

This plugin bases its ldtk module off of LDtk's quicktype-generated rust types. The quicktype definition seems to think that it shouldn't be optional, even though clearly you've ran into a case where it can be null. So, there's probably a bug upstream.

I don't think this library should even try to parse it.

Good suggestion, I agree. I would like to create a feature flag for enabling these types/fields defined as "editor-only", but it's not the easiest task in the world, especially considering that updates to the ldtk module need to be very repeatable so that they can be re-performed after the quicktype-generated file is updated. It'd be nice to make a script to do it automatically, but I haven't gotten around to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants