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]); } }
}