Update ShaderReplacer.cs

This commit is contained in:
JohnCorby 2022-03-26 10:06:54 -07:00
parent 4c03f8c9fc
commit ab95b419aa

View File

@ -1,5 +1,4 @@
using QSB.Utility; using UnityEngine;
using UnityEngine;
namespace QSB.PlayerBodySetup.Remote; namespace QSB.PlayerBodySetup.Remote;
@ -13,8 +12,6 @@ public static class ShaderReplacer
/// </summary> /// </summary>
public static void ReplaceShaders(GameObject prefab) public static void ReplaceShaders(GameObject prefab)
{ {
DebugLog.DebugWrite($"Processing shaders for {prefab.name}...", OWML.Common.MessageType.Info);
foreach (var renderer in prefab.GetComponentsInChildren<Renderer>(true)) foreach (var renderer in prefab.GetComponentsInChildren<Renderer>(true))
{ {
foreach (var material in renderer.sharedMaterials) foreach (var material in renderer.sharedMaterials)
@ -24,17 +21,9 @@ public static class ShaderReplacer
continue; continue;
} }
if (material.shader == null)
{
DebugLog.ToConsole($"Warning - Shader for material {material.name} is null.", OWML.Common.MessageType.Warning);
continue;
}
var replacementShader = Shader.Find(material.shader.name); var replacementShader = Shader.Find(material.shader.name);
if (replacementShader == null) if (replacementShader == null)
{ {
DebugLog.ToConsole($"Warning - Replacement shader found for shader {material.shader.name} was null. Sticking with the original.", OWML.Common.MessageType.Warning);
continue; continue;
} }