Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

(Case 1122461) Deserialization Problem of ScriptableObject containing Asset References

Discussion in 'Addressables' started by MNNoxMortem, Jan 30, 2019.

  1. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    274
    Error:
    Code (CSharp):
    1. A scripted object (probably SceneReference?) has a different serialization layout when loading. (Read 92 bytes but expected 164 bytes).
    2. Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
    Code (CSharp):
    1.     public class SceneReference : ScriptableObject
    2.     {
    3.         public AssetReference AssetReference;
    4.         public string DisplayName;
    5.         public string SceneName;
    6.         public string Uuid;
    7.     }
    SceneReference has no #if but AssetReference has some.

    That error message does not look helpful. The size of SceneReference should not change when the size of AssetReference changes. The only thing which comes to my mind is that the Addressable Asset System has problems with compression and that the asset is loaded compressed and then it tries to deserialize it without uncompressing it.

    Edit: Should have noted: This only happens in a WebGL build and because that is IL2CPP based I'ved added a link.xml to include the whole assembly SceneReference resides in to avoid any Stripping.
     
    Last edited: Jan 30, 2019
  2. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    327
    Thanks for letting us know, I've added a ticket to our system.
     
  3. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    274
    @unity_bill I would like to provide some more helpful information if I find out why and how this happens. This issue is mightily strange and breaks our CI/CD as the builds made via CD all show this error and no addressable can be successfully deserialized. However on my local dev machine (same platform, same build target, same OS, same profile, both times clean player content then build player content) this does not happen.

    Both machines are in the same network and use the same Cache Server (node.js based version running on the CI/CD machine). Of course both use the same Unity version.

    I will try to go through the steps I do on my machine on the CI/CD machine by hand and try to find out why there is a different serialization layout but so far I have not the slightest clue (no code changes!)
     
    unity_bill likes this.
  4. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    274
    Okay... it happens on both machines, not only the CI machine. Some builds work. Some don't.
     
  5. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    274
    Okay - two consecutive builds without a change on my side in between: One loads - one fails. I assume it is A) Cache related or B) related to files in the folder it builds the addressables into. That is the only thing I know that is different betwen two builds. Both were made with Clean Player Content > Build Player Content.
     
  6. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    274
    @unity_bill looks like this Case is actually related to Case 1117939. After failing several builds in a row I reimported scripts and assets manually and the next build worked.