Gui Text popup, fade out

Hi there!

I would like some help with a script I’m working on. It’s a battery pickup script, so when you pickup a battery a text pops up in the bottom left corner that says that you collected a battery.

I want it so when the text pops up it should fade out after a couple of seconds. Now they just stacks on top of each other by using an array.

Here’s my Inventory script:

var batteries = new Array();
var guiSkin : GUISkin;

function OnGUI()
{
    for(var i : int = 0; i < batteries.length; i++)
    {
        GUI.skin = guiSkin;
        GUI.Label(new Rect(90, Screen.height - 60 - (i*60), 120, 50), ("Picked up Battery"), "HUD");
    }
}

I hope you guys understand!

You can control the color of your GUI via GUI.color

You can fade the gui over time by using coroutines (this manual page specifically talks about implementing fading)