- Home /
Question by
dotmeep · Nov 25, 2021 at 06:48 PM ·
shadersmaterialsrenderertransparencycustom-shader
Material.SetOverrideTag seems to be broken for changing RenderType at least.
Pretty simple, I can use material.SetInt, .SetFloat, etc. with no problem. However, I'm trying to use material.SetOverrideTag("RenderType", "Transparent") and it does not change on runtime.
I can manually change the RenderType in the inspector to Transparent and it works as expected, but the script just won't do it. All other updates in the script work fine.
public static void MakeFade(Material material)
{
material.SetOverrideTag("RenderType", "Transparent");
material.SetFloat("_OutlineScale", 0);
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
material.SetInt("_ZWrite", 0);
material.DisableKeyword("_ALPHATEST_ON");
material.DisableKeyword("_ALPHABLEND_ON");
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613045808im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to make make an object look like an Opaque but still have Alpha fading effect? 1 Answer
Fuse objects visually when close to each other Shader/ Effect 2 Answers
Transparent shader decreases frame rate. Which material i should use for transparent object? 3 Answers
How do I properly apply a transparent texture to a mesh? 2 Answers