- Home /
Restart with GUIText
I have made a health for the player represented as GUI Text. So when the player reaches 0, the numbers go negative. so what I want for my health script to do is to load level 0 when the GUI Text reaches to -1.
Felipe
Answer by AlucardJay · May 16, 2012 at 04:27 PM
convert your GUI Text to an int / float : parseInt(GUIText) or parseFloat(GUIText)
: , then check that if (GUITextInt <= 0) Application.LoadLevel("Level0");
http://answers.unity3d.com/questions/11581/convert-string-to-float.html
http://answers.unity3d.com/questions/19053/extract-number-from-string.html
Answer by awesomealex · May 29, 2012 at 12:29 PM
It works well, I made an if (health<=1){ Application.LoadLevel (0);
Tks
Your answer
Follow this Question
Related Questions
Taking a hit 3 Answers
Deduct health on collision 2 Answers
how to display the damage value from a mob 1 Answer
Setting Scroll View Width GUILayout 1 Answer
problem with displaying GUI 1 Answer