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:
for (int ndx = 0; ndx < renderers.Length; ndx++) {
int matCount = renderers[ndx].materials.Length;
for (int ndx2 = 0; ndx2 < matCount; ndx2++) {
Shader shader = renderers[ndx].materials[ndx2].shader;
if (string.IsNullOrEmpty(shader.name) || !shader.isSupported) {
renderers[ndx].materials[ndx2].shader = Shader.Find(legacyDiffuseShaderName);
}
}
}
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)