Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Asset bundle support between 5.5 and 5.6?

Discussion in '5.6 Beta' started by peteradvr, Jan 13, 2017.

  1. peteradvr

    peteradvr

    Joined:
    Dec 22, 2016
    Posts:
    11
    Should I expect an asset bundle built using 5.5 to load in the 5.6 beta?

    I get a bunch of warnings like so: "Failed to load GpuProgram from binary shader data in 'Mobile/VertexLit'."
    and erorrs like so: "D3D shader blob is empty!"

    The geometry from the asset bundle seems to load fine.

    What is odd is typically if there is a problem with a material or shader the object shows up pink in the editor. In my test case it just doesn't appear at all. But if I hunt it down and click on it in the Hierarchy it will suddenly start rendering, but pink.

    I'm trying to automatically correct the problem to avoid having to rebuild these asset bundles.
    My code here marches all MeshRenderer's and SkinnedMeshRenderer's in the scene after loading my asset bundles to check to see if they shaders are ok and if not try to fix it. Like this:
    Code (CSharp):
    1.             for (int ndx = 0; ndx < renderers.Length; ndx++) {
    2.                 int matCount = renderers[ndx].materials.Length;
    3.                 for (int ndx2 = 0; ndx2 < matCount; ndx2++) {
    4.                     Shader shader = renderers[ndx].materials[ndx2].shader;
    5.                     if (string.IsNullOrEmpty(shader.name) || !shader.isSupported) {
    6.                         renderers[ndx].materials[ndx2].shader = Shader.Find(legacyDiffuseShaderName);
    7.                     }
    8.                 }
    9.             }
    This trick has worked well for me in the past but isSupported is true here so I don't have any way to know to regress to a shader that I know will at least show something not pink.

    My fantasy here is that our 5.5 asset bundles will eventually work in future builds of 5.6 but if that is not an officially supported path I'd appreciate any advice that would help work around the issue. We are only using shaders that ship with Unity, nothing custom.

    Thanks! (I've already logged a bug about this)
     
    Wothanar likes this.
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,646
    Can we get a bug report on this?
     
    Wothanar likes this.
  3. peteradvr

    peteradvr

    Joined:
    Dec 22, 2016
    Posts:
    11
    Filled as 869927

    I was told as a response to that bug last night that: "Asset bundles have to be rebuilt on ever major release, so yeah, you have to rebuild it on 5.6 to make them work properly."

    Which is unfortunate for me and my team.

    It almost works. The mesh/animation data is all there. If in the editor I go and find the materials which is set to "Mobile/Diffuse", and do nothing but select in the shader name combo box "Mobile/Diffuse" again everything works as expected. Our model renders perfectly. It feels like there could be a quick fix here that could get 5.5 asset bundles to work on 5.6 (Either on Unity side as a bug fix or on our side by detecting/correcting the difference).

    Think we might see an asset bundle migration tool in the future?
     
  4. Kuddy

    Kuddy

    Joined:
    Feb 11, 2014
    Posts:
    4
    I'm having the same problem right now, but sadly no progress so far.
    Even for the default standard shader, when loading the bundles i get:
    I'm trying to re-build bundles, re import materials, but no luck so far
     
    Wothanar and rjohannessen like this.
  5. jonlab

    jonlab

    Joined:
    Apr 6, 2010
    Posts:
    182