Assetbundle Shader 丢失的解決方案

gameObject.renderer.material.shader = Shader.Find(gameObject.renderer.material.shader.name);

或者

public class ApplyShader : MonoBehaviour
{
private Material[] thisMaterial;
private string[] shaders;
void Start () {
thisMaterial = this.renderer.sharedMaterials;
shaders = new string[thisMaterial.Length];
for( int i = 0; i < thisMaterial.Length; i++){ shaders[i] = thisMaterial[i].shader.name; }

for( int i = 0; i < thisMaterial.Length; i++){ thisMaterial[i].shader = Shader.Find(shaders[i]); } }
}

你可能感兴趣的:(Assetbundle Shader 丢失的解決方案)