using UnityEngine; using System.Collections; public class LoadShader : MonoBehaviour { // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { #if !UNITY_WEBGL || UNITY_EDITOR SetShader(transform); #endif } // Update is called once per frame void Update() { } public void SetShader(Transform child) { if (child.childCount > 0) { for (int i = 0; i < child.childCount; i++) { SetShader(child.GetChild(i)); } } else { if (child.GetComponent()) { var r = child.GetComponent(); foreach (var material in r.materials) { //Debug.Log(material.shader.name); if (material.shader.name == "Universal Render Pipeline/Lit") { StartCoroutine(setshader(material)); } } } } } IEnumerator setshader(Material m) { m.shader = null; yield return new WaitForSeconds(0.1f); m.shader = Shader.Find("Universal Render Pipeline/Lit"); } }