//assetbundle後shader會lost的處理 gameObject.renderer.material.shader = Shader.Find(gameObject.renderer.material.shader.name);
或是
using UnityEngine; using System.Collections; 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]); } } }
沒有留言:
張貼留言