Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Bug] [100%] [Example project attached] ContentPipeline will not correctly serialize data from .dll

Discussion in 'Addressables' started by NWalker_FGOL_Ubisoft, Jul 19, 2018.

  1. NWalker_FGOL_Ubisoft

    NWalker_FGOL_Ubisoft

    Joined:
    Aug 10, 2015
    Posts:
    25
    Hey,

    Full Example Project Zip:
    https://drive.google.com/file/d/1eoLz04BJrf84I7F4GZACaf9H3ntWdlkD/view?usp=sharing

    • Asset Bundle sourced ScriptableObjects built via ContentPipeline will have default (but not null for Reference types) data when the serializable type exists in a class library (.dll).
    • 100% repro rate in the Editor and on Android.
    • Classes and Structs both fail.
    • They work with traditional asset bundles and when using Fast mode.
    • The data type of the fields does not matter. I.e. All types will fail to deserialize.
    • Building in DEBUG vs RELEASE does not matter.
    • Testing with and without Assembly Definitions does not change the result.
    • Target Framework of the dll is Unity 3.5 .net full Base Class Libraries. Testing all other subsets fails also.
    • Building the DLL with Build->Advanced->Language Version: C# 4. Tested C# 3 with identical results.
    • The DLL's meta file is marked for "Any Platform".
    • I have not tested MonoBehaviours, although it would be trivial for you to do so with the source.
     
    Last edited: Jul 25, 2018
  2. NWalker_FGOL_Ubisoft

    NWalker_FGOL_Ubisoft

    Joined:
    Aug 10, 2015
    Posts:
    25
    Bump as added 100% repro instructions + full example source + specific issue.
     
  3. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    559
  4. NWalker_FGOL_Ubisoft

    NWalker_FGOL_Ubisoft

    Joined:
    Aug 10, 2015
    Posts:
    25
    (Case 1064077) Addressables: ContentPipeline.BuildAssetBundles will corrupt ScriptableObjects built via a Class Library
     
  5. Tomas-Kiniulis

    Tomas-Kiniulis

    Unity Technologies

    Joined:
    Apr 27, 2017
    Posts:
    55
    Hey,

    I've reproduced this bug and have sent it for resolution with our developers.

    We highly appreciate your contribution. Let us know if you have any further questions.
     
  6. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    332
    @NWalker_FGOL_Ubisoft Thanks for the fogbugz, I've got an idea on what's happening but don't have a workaround yet.
     
    NWalker_FGOL_Ubisoft likes this.
  7. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    332

    @NWalker_FGOL_Ubisoft this is going to require a path to unity to fix sadly. However I do have a potential work around. What you are running into is field stripping that is controlled by the TypeDB because the one returned by the compile scripts step does not know about your dll (what I'm fixing right now).

    So the quickest work around for now is to tell the build pipeline not build scripts, this will make the TypeDB be null and thus we fall back to currently running editor code to determine fields to write to disk. The downside to this is that, depending on your serialized classes, you could end up with more in your bundles than expected. However, this will at least get you up and running until the patch lands.
     
  8. NWalker_FGOL_Ubisoft

    NWalker_FGOL_Ubisoft

    Joined:
    Aug 10, 2015
    Posts:
    25
    Thanks for the update, @Ryanc_unity . When I get time I'll look into this workaround.
     
  9. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    332
    @NWalker_FGOL_Ubisoft the Unity fix was approved for 2018.2.3f1 I just barely missed the cutoff for 2018.2.2f1.
     
  10. NWalker_FGOL_Ubisoft

    NWalker_FGOL_Ubisoft

    Joined:
    Aug 10, 2015
    Posts:
    25
    Great, thanks Ryan. Great turnaround.
     
  11. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    332
    Easy fix for a new feature and a solid repro case. Makes a world of difference, thank you =D