public bool Prepare() { _materialRefs = new List <SkinShaderMaterialSnapshot>(); foreach (var material in GetMaterialsToHide()) { var materialInfo = SkinShaderMaterialSnapshot.FromMaterial(material); Shader shader; if (!ReplacementShaders.ShadersMap.TryGetValue(material.shader.name, out shader)) { SuperController.LogError("Missing replacement shader: '" + material.shader.name + $"' ({material.name} will not be hidden)"); } if (shader != null) { material.shader = shader; materialInfo.alphaAdjustSupport = material.HasProperty("_AlphaAdjust"); materialInfo.alphaCutoffSupport = material.HasProperty("_Cutoff"); materialInfo.specColorSupport = material.HasProperty("_SpecColor"); } else { materialInfo.alphaAdjustSupport = materialInfo.originalAlphaAdjustSupport; materialInfo.alphaCutoffSupport = materialInfo.originalAlphaCutoffSupport; materialInfo.specColorSupport = materialInfo.originalSpecColorSupport; } _materialRefs.Add(materialInfo); } // This is a hack to force a refresh of the shaders cache _skin.BroadcastMessage("OnApplicationFocus", true); return(true); }
public bool Prepare() { _materialRefs = new List <SkinShaderMaterialSnapshot>(); foreach (var material in KnownMaterials.GetMaterialsToHide(_skin)) { var materialInfo = SkinShaderMaterialSnapshot.FromMaterial(material); Shader shader; if (!ReplacementShaders.ShadersMap.TryGetValue(material.shader.name, out shader)) { SuperController.LogError("Missing replacement shader: '" + material.shader.name + "'"); } if (shader != null) { material.shader = shader; } _materialRefs.Add(materialInfo); } // This is a hack to force a refresh of the shaders cache _skin.BroadcastMessage("OnApplicationFocus", true); return(true); }