MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

GridObjectCollection serialization issues

Open Kent1LG opened this issue 6 years ago • 5 comments

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

Kent1LG avatar Dec 19 '19 09:12 Kent1LG

@julenka FYI

Troy-Ferrell avatar Dec 20 '19 06:12 Troy-Ferrell

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.

julenka avatar Dec 23 '19 20:12 julenka

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!

Kent1LG avatar Dec 27 '19 13:12 Kent1LG

@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;

gilbdev avatar Jan 02 '20 07:01 gilbdev

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.

julenka avatar Jan 02 '20 18:01 julenka