I was thinking about the game to make a bloodscreen if i am in shot and my health is filling by himself. If my health is full, then the bloodscreen is gone. Can someone help me with this? How to fix that?
I was searching at GOOGLE, but no results.
PS: I'm using Unity 3.3 Pro
I'm at school right now but I'll tell you when I get home. I just figured out how to do it for my game yesterday.
You basically make a 2 GUI textures one is your bloodscreen and one is completely blank. then with the blank one selected go gameobject > create other > GUI texture then add a script to it with a boolean which is set to true when the health < full health. and if this is true, guitexture.texture = bloodscreen. else guitexture.texture = blank. it is false when health is full.
I'll explain in detail when I get home..
OK so open up photoshop and make a new file call it bloodScreen (I prefer 1024 X 1024) then add blood splatter to it and leave the background transparent (not white) and save it as a .PSD file. Now create another Photoshop document (call it NoBlood) and leave it completely blank (not even transparent. i hope you are familiar with photoshop)
now import the 2 files you just created to unity and with the noBlood one selected go gameobject > Create Other > GUI texture. Name this "blood". Now create a new script call it bloodSplatter and add this code to it -
static var blood = false;
var noBlood : Texture2D; //this is your blank texture
var hit : Texture2D; // and this is the blood splatter texture
//after saving the script drag the textures to their slots
function Update ()
guiTexture.texture = hit;
blood = false;
guiTexture.texture = noBlood;
Add this script to the guitexture you created (blood). Now open up FPSPlayer script and scroll down to ApplyDamage. In that function add -
bloodSplatter.blood = true; // you have to call the above script "bloodSplatter"
The script has been tested but not with the fps tutorial. Hope it works
networkZombie's solution should work, but isn't particularly elegant. It won't fade the texture based on your health either.
For what you're asking, I'd suggest that you take a look at a very similar question/answer: "shoot the player effect"