The asset bundle is loaded dinamically and an asset is displayed on screen. It contains a shader, but the surface is black instead.
Also, the console displays a following exception: âShaderLab error: Shader âReflective/BumpedSpecularRefractiveâ: no subshaders can run on this graphics cardâ.
Interesing, because when not using an asset bundle - but directly putting the prefab on stage - shader works.
Iâm having the same problem. When I bundle my models (fbx), with all dependencies, itâll bundle all textures (.tga) and .shader files that I use. But during runtime, when I load up the assets through the assetbundle, I see that the material using a shader and click âEditâ, it shows that thereâs a compiler issue with that shader. But the shader worked fine before hand. I found that most of my shaders worked after loading them through the assetbundle, except one shader.
Iâm having the same issue as well, the shader I used works perfectly if I use it directly, but it says the graphics card doesnât support it if I load it using Assetbundles.
I have to re-assign the shader (with Shader.Find) after I load my model to make it look right.
Anyone have a solution to this? Is it because Iâm doing something wrong when I build my assetbundles?
Guys, a bad news is: shaders are considered code, and custom code doesnât work in asset bundles (when you export the asset bundle, it contains no code).
Meaning: if you call some shaders and scripts in your asset bundle, they have to be present inside the main Unity file.
This thread is a little old, but Iâm posting information in related threads of our community, to clarify how Shaders and Asset Bundles work together, and how to avoid some conflicts. The shaderâs code is included with the asset bundle, whenever shaders are directly referenced as parameters in BuildPipeline.BuildAssetBundle(), or indirectly with option BuildAssetBundleOptions.CollectDependencies. This could cause a problem if you use BuildAssetBundle alone to create several asset bundles, since referenced shaders will be included in every generated bundle. There could be conflicts, i.e. when you mix different versions of a shader, so you will have to rebuild all your bundles for any modification. This also increases the size of bundles. To avoid these problems you can use BuildPipeline.PushAssetDependencies() to separate shaders in a single bundle, and that will allow you to update the shader bundle only. We are adding a page to the manual with more information on this topic and examples of the workflow to build a shader bundle.
It would be great if this could work. It would mean that an online 3D world would be created, and then populated wit custom 3D models (having their own shaders) uploaded by users.