Adding a material to a GUI label

Hi,

Is there any possible way to add a material (with transparency/cutout shader) to a GUI label?

I’m following Eric5H5’s answer halfway down the page on this post

I’m doing a similar thing, except mine is half a circle. I have 3 textures in total:

back - backing texture
middle - half circle texture with alpha gradient
front - sits on top and frames the half circle

Back and front are GUI labels. I made middle a plane because I couldn’t find a way to apply a material to a GUI object. However, back draws over the top of middle because its a GUI object. So is there any way to apply a material to a GUI object, because I would love middle to be GUI.

If not, I will have to make back and front planes as well, but there are a couple of other problems:

  1. The plane I made for middle has 200 tris, any way to reduce this to 2?
  2. In the transparant\cutout shaders, only ‘Soft Edge Unlit’ appears at the proper brightness. All the others are too dark. But ‘Soft Edge Unlit’ doesn’t work completely right when I change the ‘base alpha cutoff’, whereas the others work properly. Any ideas why?

Make the plane in Blender.

Ok so that would fix problem 1, what about number 2? And I’m guessing the answer to the original question is no?

No, you can’t use materials in OnGUI functions. If you use the vertex-lit cutout shader, you can just change the color and/or emissive color to suit. Or make a modified shader by taking that one and removing the lighting, which isn’t necessary for most GUI stuff.

–Eric

Ok thanks. I got the colour right using the vertex-lit cutout shader, and used 3ds Max to make a plane and imported to unity. Got it all working now. There’s a jagged white line around the edge of the circle when the cutoff value gets close to 0, but I’ll just get the artist to thicken the frame of the front texture to cover it up.