GridObjectCollection serialization issues
Describe the bug
The following errors appears when you launching a MRTK 2.2 application :
`A scripted object (probably Microsoft.MixedReality.Toolkit.Utilities.GridObjectCollection?) has a different serialization layout when loading. (Read 88 bytes but expected 92 bytes) Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
(Filename: C:\buildslave\unity\build\Runtime/Serialize/SerializedFile.cpp Line: 2001)
A scripted object (probably Microsoft.MixedReality.Toolkit.Utilities.GridObjectCollection?) has a different serialization layout when loading. (Read 660 bytes but expected 664 bytes) Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
(Filename: C:\buildslave\unity\build\Runtime/Serialize/SerializedFile.cpp Line: 2001)
A scripted object (probably Microsoft.MixedReality.Toolkit.Utilities.GridObjectCollection?) has a different serialization layout when loading. (Read 660 bytes but expected 664 bytes) Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
(Filename: C:\buildslave\unity\build\Runtime/Serialize/SerializedFile.cpp Line: 2001)
A scripted object (probably Microsoft.MixedReality.Toolkit.Utilities.GridObjectCollection?) has a different serialization layout when loading. (Read 660 bytes but expected 664 bytes) Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
(Filename: C:\buildslave\unity\build\Runtime/Serialize/SerializedFile.cpp Line: 2001)`
Everything is fine on Unity Editor.
To reproduce
Steps to reproduce the behavior:
In my case : 1 - I updated a MRTK 2.1 project to 2.2 2 - Build and deploy
Expected behavior
No errors.
Your setup (please complete the following information)
- Unity Version 2018.4.12f1
- MRTK Version 2.2 (Nugget)
Target platform (please complete the following information)
- HoloLens 2
@julenka FYI
Does this happen after you save your project and re-deploy? We did add some new fields to GridObjectCollection, wonder if during upgrade those new fields did not get added, especially when using NuGet.
Hey @julenka sorry for the late. Yes, even after close/open Unity project, build many times and deploy as well, same result. I m not suprised if it's about Nugget, i noticed so many issues about it (like : no hand tracking in Remote simulation unity editor in some projects). Even if i just dodge the problem, did you know a fast solution?
Thank you ! Merry Christmas and Happy new year!
@julenka the property assetVersion is serialized only in UNITY_EDITOR, this is what's causing the issue ;)
#if UNITY_EDITOR
[SerializeField]
[HideInInspector]
private int assetVersion = 0;
Ah, great catch, thank you @gilbdev! I don't remember why I only serialized this in UNITY_EDITOR, so we can probably remove that. @Kent1LG I believe if you remove that #if UNITY_EDITOR check you should get unblocked.