Hi bali & Pharan,
Have you guys found a workaround for this? I have exactly the same issue right now with my asset bundle setup π
All of my art assets are in one bundle, which variants for each target resolution (e.g., art.sd, art.hd). The art asset bundles also include my Spine assets, since each variant has a different atlas and Skeleton scale. I have my scenes in separate asset bundles, and those scenes have dependencies on the art bundles.
When I load a scene and its dependencies with the default (HD) variant, everything works fine. But when I load a scene with the non-default variant (SD), all of my Spine objects lose their references to their Skeleton Data Assets.
All of my non-Spine objects work just fine. What this suggests to me is that the Skeleton Data Assets in my variant bundles are somehow being assigned a different GUID than the assets in my default bundle.
This is a huge blocking issue for me right now π Any ideas? π
08 Apr 2016, 15:19
I found a clue! π
My suspicion now is that there's a bug in Unity's scene loading behaviour when a scene contains references to a ScriptableObject data type that needs to be loaded from a variant asset bundle.
I created a test scene that displays an HD Spine animation. It also loads a dummy ScriptableObject data file that has nothing to do with Spine. I placed all of my HD Spine assets + my dummy data asset into an art.hd asset bundle. I then created an art.sd asset bundle variant that has clones of all of the HD + dummy data assets. Lastly, I placed my test scene in its own asset bundle.
After building the bundles, I load the test scene and all of its dependencies using the .hd variant. Everything works as it should π I then load the test scene and all of its dependencies using the .sd variant. Now, any component in the scene with a reference to a ScriptableObject asset (like the Skeleton asset and my dummy data asset) loses its reference, and everything is broken.
So, it's not a problem that's specific to Spine.
I did discover a workaround for the issue, though! If I manually call assetBundle.LoadAllAssets() on my dependency bundles before loading the test scene, the ScriptableObject assets get loaded correctly and everything works! π That makes me think that Unity's scene loading isn't properly calling assetBundle.LoadAsset() on the ScriptableObject types when using a variant bundle.
I hope that helps! I'm going to test this in the 5.4 beta, and if it's still an issue, I'll report a bug to Unity.