Files
JJBB/Assets/Project/Script/Plugin/ShaderFix.cs

19 lines
491 B
C#
Raw Normal View History

2024-08-23 15:49:34 +08:00
using UnityEngine;
using System.Collections;
public class ShaderFix : MonoBehaviour {
private void Awake()
{
#if UNITY_EDITOR
foreach (Transform t in gameObject.GetComponentsInChildren<Transform>())
{
if (t.gameObject.GetComponent<Renderer>() != null)
{
t.gameObject.GetComponent<Renderer>().material.shader = Shader.Find(t.gameObject.GetComponent<Renderer>().material.shader.name);
}
}
#endif
}
}