I am trying to make a multiplayer fps game. I want to flash a red gui texture for each player that gets hit by another player. I instantiate each player as a prefab. I tried to put the gui texture inside the prefab so that each player has its own red gui texture, but this doesnt work cause i cant see the texture after i instantiate it in the network.
For example when player2 gets hit by player1 i want to retrieve the guitexture of player2 and flash it in front of player 2. I hope u understand what i want to do.
Thnx in advance.
I am using this script for flashing the texure:
function Fade (start : float, end : float, length : float, currentObject : GameObject) { //define Fade parmeters
if (currentObject.guiTexture.color.a == start){
for (i = 0.0; i < 1.0; i += Time.deltaTime*(1/length)) { //for the length of time
currentObject.guiTexture.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;
currentObject.guiTexture.color.a = end; // ensure the fade is completely finished (because lerp doesn't always end on an exact value)
} //end for
} //end if
} //end Fade
function FlashWhenHit (){
Fade (0, 0.8, 0.5, GUITextureobjectname);
yield WaitForSeconds (.01);
Fade (0.8, 0, 0.5, GUITextureobjectname);
}