- Home /
How to I make a Death Counter?
Hey, I'm working on a 2d game where two sprites try to kill each other by pushing them off a platform. After one dies, they return to their starting position. I would like to make a GUI Text that tells how many times each person has died. I'm unsure of how to go about doing this. Whats the best way to (c#) script this?
Comment
Answer by j0ffe · Nov 30, 2013 at 01:29 AM
Check out GUI.box http://docs.unity3d.com/Documentation/ScriptReference/GUI.Box.html
int deathCounter;
Update(){
if(){
deathCounter++;
}
}
void OnGUI(){
//Draws out a box on position x and y, with a specified width and height and width.
GUI.Box(pos.x,pos.y,width,height,deathCounter.ToString());
}