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
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.
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
It works well, I made an if (health<=1){ Application.LoadLevel (0);
Tks