2D how to show a number on enemies' head and enemy flash red

i want my enemies to flash a color on collision, i’ve found this code but this only changes the color of the object for a while i want a fading effect somehow

var colors = new Color[2];

function OnCollisionEnter() {
renderer.material.color = colors[0];
yield WaitForSeconds(.5);
renderer.material.color = colors[1];
}

hope its ok to ask another question, which is my main one im pretty bad with GUIs and i want to show a number(enemy damage) on top of the enemies head, so its a random location and in 2D.
im not quite sure where to start on this, any help would be nice

1 Answer

1

these may help ,

http://unity3d.com/support/documentation/ScriptReference/Material-color.html

i don't get the idea of number thing, are you making a 'top view' game or 'side view' ? Only saying 2D won't do work .. i think

i didnt see that it mattered but its top view, i want to show the damage im dealing to enemies on hit. mainly show a label on a moving target. thx for the links i looked around b4 but i thought the 'lerp' function was only for something like flashing the entire screen