美文网首页
Assetbundle Shader 丢失的解決方案

Assetbundle Shader 丢失的解決方案

作者: 自由的天空 | 来源:发表于2016-05-31 10:52 被阅读932次

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 丢失的解決方案

      本文链接:https://www.haomeiwen.com/subject/jwmcdttx.html