so i want a simple blood damage gui to show whenever the player takes damage, so far ive got this, but it doesn’t seem to work.
that codes just a snippet of the fpsplayer.
Are you calling ApplyDamage from OnGUI? GUI.DrawTexture and the other GUI functions only work when called from OnGUI.
but how do i get it to work, all i want is it to draw the texture when i get hit.
A typical way to handle something like this is to set a boolean variable in the ApplyDamage function and then check for this value in OnGUI:-
var showBlood: boolean;
function ApplyDamage (damage : float) {
...
showBlood = true;
...
}
function OnGUI() {
if (showBlood) {
GUI.DrawTexture(Rect(0, 0, 1950, 1100), texture);
}
}
You may need to do a bit more if you want the texture to disappear after a time limit or whatever.
thanks andeeee, i managed to get some help of a friend