How to make this image semi-transparent?

Imgur

This is suppose to be a “hurt” image, in that when your health falls at like 3 hearts or something, this will automatically appear. The problem that I have is that I have no clue on how to make this semi-transparent. I looked up a lot of places, and it said something about color.a and alpha and all that stuff. Is that what “Opacity” is? Also, how can I can stretch that image to screen width and height? I want to change the image’s properties via script. I find some things that are very annoying on Unity that they can’t just make a simple “Opacity: <1-100>” property.

AngryCSharpNerd,

There are several ways of doing this, but the one I would most likely use (from what you’ve described) is to create a GUI Texture object that holds the image.

So, I’d start by creating the image using (Gimp/Photoshop/Paint/etc…) without any transparency, then bring it in as an asset in Unity. Select it, then go to the “GameObject” menu, select a GUI Texture (which will automatically create it with the right resolution, etc…) then you go to the inspector, select the Color segment and then change the Alpha value to what you’d like.
Then, once that’s done you can use a script to tell the image to appear and, because it’s a GUI Texture, it will be viewed on top of everything else as desired.

To make it prettier, though, you can use a script to manually change the alpha value so that when the image is needed you can fade into it being there and increase/decrease it’s opacity to reflect intensity.

Use a full-screen GUITexture (not OnGUI code) and set the alpha appropriately.

I find some things that are very annoying on Unity that they can’t just make a simple “Opacity: <1-100>” property.

Well, except you can, for just about everything. But alpha is not 0-100, it’s 0.0-1.0.

Try using Photoshop or another solution to create a semi transparent png or create a dds with a grey alpha layer.