Is it possible to change the blend mode for GUI elements? I’m using 2 images with alphas in 2 GUI.Label calls. The first image is black with about 20% transparency. The second image is a solid rectangle with a “blob” shadow in the lower corner. The shadow image has a light halo around it that shouldn’t be there. In the attached image you can see what I’m talking about in the lower left corner.
You can try to:
-
Work with alpha in your images, just make sure your textures use a compression setting that allows for alpha.
-
Set the GUI.color in between the two Label calls so you can draw them using separate global transparency settings.
Sorry to bump an old topic, but the original question didn’t (really) get answered, and I had exactly the same question now, so it seemed wise to reuse this topic.
Can Unity GUI (ie: GUI.Button, GUI.Window, etc and NOT GUITexture and GUIText objects) use blend modes? It would be nice to be able to use additive blending instead of plain old alpha blending.
AFAIK, no.
I know this is an ancient thread, but for people who come here with the same issue like me, here’s how to solve it.
So the issue is that semi-transparent dark textures lighten the background, which gives the “light halo” effect in the OP. The solution is to set the GUI colour to black temporarily instead of white. e.g.
GUI.color = new Color(0, 0, 0, 1);
GUI.DrawTexture(new Rect(0, 0, MyImage.width, MyImage.height), MyImage);
GUI.color = Color.white;
In case someone is looking for the solution to set different blend modes to the GUI elements (like in Photoshop), here is a plugin in the asset store, which allows doing that: Unity Asset Store - The Best Assets for Game Making