How to make a glowing icon on a HUD?

Hi,

I'm trying to make an icon on my HUD glow like a warning sign. A sine wave would be very good, but I have no idea how to implement one. Right now I'm using GUI.DrawTexture.

Thank you.

Look at both GUI.color and Mathf.PingPong. You can change the alpha of the GUI color with something along the lines of

GUI.color.a = Mathf.PingPong (Time.time, 1);

just before you call `GUI.DrawTexture`. If you want to have a minimum opacity higher than `0`, though, you'll have to write your own PingPong function.

When you've drawn your texture set

GUI.color.a = 1;

Note that direct modification to Color.a only works in Javascript-flavored scripting. If you're working in C#, you'll have to do something like

GUI.color = new Color (GUI.color.r, GUI.color.g, GUI.color.b, 1);

Make a image in Photoshop (Or whatever) and then add it to Unity...

Since there seems no way to change the opacity of a GUITexture (someone correct me if I'm wrong), you won't be able to make it glow by changing the opacity.

Therefore I assume that the only way to achieve a pulsating effect would be to produce a series of images with the changing glow and cycle through them.

You can change a GUITexture opacity over time by altering

GUITexture.color.a

For example:

function AnimateGUITextureOpacity (start : float, end : float, length : float, target : GUITexture) { 

for (i = 0.0; i < 1.0; i += Time.deltaTime*(1/length)) { //for the length of time

target.color.a = Mathf.Lerp(start, end, i); //lerp the value of the transparency from the start value to the end value in equal increments
yield;
target.color.a = end; // ensure the fade is completely finished
    } //end for

} //end function

will lerp the opacity of a GUITexture over time with a start and end value and speed you define as well as the specific GUITexture you want it to apply to.