I am trying to set the transparency of the material on my mesh, however while I can see in the editor that the alpha is set to the correct value, the mesh renderer that the material is on only seems to render with no transparency. All the other values are updated and are rendered correctly.
When I manually adjust any values of the material in the inspector though, the transparency suddenly starts to be rendered correctly.
This is what I’m using to update the material on the mesh:
Material material = new Material(Shader.Find("Universal Render Pipeline/Unlit"));
material.mainTexture = textures[0];
material.SetFloat("_Surface", 1);
material.SetFloat("_Blend", 0);
material.SetColor("_BaseColor", new Color(0f, 1f, 1f, 0.5f));
meshRenderer.material = material;
I’ve been trying to figure this out for hours now so I’d be grateful if anyone could help me understand why this occurs and what I should do to allow me to make the material render correctly. Thanks
