Bug: serialization order auf Auto Save for RectTransform issue

Discussion and help for Easy Save 3
Post Reply
MartinL
Posts: 4
Joined: Sun Oct 09, 2022 12:49 pm

Bug: serialization order auf Auto Save for RectTransform issue

Post by MartinL »

Hey dear coders,
I just started today and had a bit headache, but now I found out was it is the issue and I ask you to fix this please - I will give you a summary and how to reproduce it

when serializing a RectTransform with anchored position and parent data is saved properly BUT since the anchoredPosition is BEFORE the parent we get it loaded in the wrong order as Unity changes the position/offset. When changing the serialization order in the autosave file it works properly (parent before anchoredPosition) but this only holds until the next time when autosave again creates a new file with having anchoredPosition again right before parent

how to create a simple scene to reproduce it:
create a canvas with inside two empty gameobjects like "container1" and "container2"
then create another gameObject with like a sprite or whatever, it doesn'nt matter
enable autosave on this "sprite" gameObject with RectTransform's anchoredPosition and parent
put this gameObject (with Position (0,0)) on "container1" go in play mode and drag and drop this to "container2" in hierachy
stop play mode: in your save game the anchored position and parent is saved properly
but when you now again start play mode first the anchoredPosition is loaded and then the parent and with that the anchoredPosition is no more like 0,0 but the offset to the previous parent

Thank's for looking into this. I guess just changing the order of the savegame file will do the trick if there are no other sideeffects I am not aware of
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Bug: serialization order auf Auto Save for RectTransform issue

Post by Joel »

Hi Martin, and thanks for the bug report.

By default we serialize fields in the order that Unity returns them when using reflection, but in this situation it looks like we need to override this order.

I'll get this resolved in the next update. In the meantime if you private message me your invoice number I'll send over the update right way as it's a simple fix at our end.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
MartinL
Posts: 4
Joined: Sun Oct 09, 2022 12:49 pm

Re: Bug: serialization order auf Auto Save for RectTransform issue

Post by MartinL »

cool, thanks
No stress if the update takes not weeks, I am good to wait :)
Post Reply