Question by
t-heo · Sep 15, 2020 at 11:13 AM ·
shaderbuttontransparencygridbutton backround
Buttons are not transparent against Grid
Hi!
Having a problem with having transparent buttons, that show through a Grid behind them. I would kindly appreciate tips to overcome this. The code for the Grid shader is the following, but I haven't been able to make sense of it. This issue only affects button (Canvas > UI > Button Sprites).
{
var shader = Shader.Find("Hidden/Internal-Colored");
lineMaterial = new Material(shader);
lineMaterial.hideFlags = HideFlags.HideAndDontSave;
//alpha blending
lineMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
lineMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
// backface culling off
lineMaterial.SetInt("_Cull", (int)UnityEngine.Rendering.CullMode.Off);
// depth writes off
lineMaterial.SetInt("_ZWrite", 0);
}
error.jpg
(39.5 kB)
Comment
Your answer
Follow this Question
Related Questions
Ui layout elements keep reverting after taken outside of grid element 0 Answers
how to hide objects inside an invisible object? 0 Answers
Leaves disappear in game mode 0 Answers
URP Two sided transparency Artefacts? 0 Answers
Best way to achieve color by data? 0 Answers