- Home /
The question is answered, right answer was accepted
Mesh material has little plus signs inside of it when I try to set transparency until I expand shader in editor
I am trying to set the transparency on the material on a dynamically created mesh as follows:
MeshRenderer mr = waterMesh.gameObject.AddComponent<MeshRenderer>();
mr.material.mainTexture = texture;
mr.material.EnableKeyword("_ALPHABLEND_ON");
mr.material.SetFloat("_Mode", 3.0f);
mesh.RecalculateBounds();
mesh.RecalculateNormals();
The mesh material updates slightly but has these little plus signs inside of it:
The mesh material stays in this state until I expand the shader on the material in the editor. After expanding the shader, the material refreshes and appears as expected:
Is there some setting I am forgetting to set or some method I need to call in order for this update to happen when the material is edited in my code?
Any feedback would be appreciated, I have been stuck on this for awhile.
At a glance, the images have a slight difference in alignment. $$anonymous$$ore notably, it looks like many pixels are offset between the images, yet not all of them are. Is the view we're seeing in those images the scene view or game view?
It is the scene view but the game view looks exactly the same.
Hmm... I haven't been able to find anything obvious that would lead to this off hand...
One thought that comes to $$anonymous$$d regardless, however: Based on your sample code, it looks like this is using or is based on the Standard Shader (linked as a reference on the full changes made when switching rendering modes). With that in $$anonymous$$d, you'll need to make sure that your build will support the shader variants for the Standard shader as well.
Unfortunately, I'm really not sure what would lead to the exact appearance you're seeing. Expanding the shader panel means that something's not in quite the right state at first, but I'm not certain which thing that would be.