Shader Duplication With AssetBundles (Unity)

Shader Duplication With AssetBundles (Unity)

Symptoms

  • When I profile my game I can observe multiple instances of the same shader are getting loaded.

Cause

If you have two AssetBundles using the same shader or material, but they are not tagged into any AssetBundle, Unity will pack the shader in each bundle. This could also happen if you use your shader/material in a local scene and pack the shader/material into an AssetBundle.

Resolution

Choose which assets will be on AssetBundles and which in the executable. You can pack your materials or shaders into one common AssetBundle (for example art.unity3d) and load this bundle first.

Was this article helpful?

Related Articles