x


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
more ▼

asked Feb 01 '12 at 12:15 AM

BigBlob gravatar image

BigBlob
325 36 62 66

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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

more ▼

answered May 16 '12 at 04:27 PM

alucardj gravatar image

alucardj
13.5k 34 55 86

(comments are locked)
10|3000 characters needed characters left

It works well, I made an if (health<=1){ Application.LoadLevel (0); Tks

more ▼

answered May 29 '12 at 12:29 PM

awesomealex gravatar image

awesomealex
-10

It actually looks that it works, thanks ill try

May 29 '12 at 03:27 PM BigBlob
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5051
x3669
x801
x383
x18

asked: Feb 01 '12 at 12:15 AM

Seen: 804 times

Last Updated: Nov 09 '12 at 05:24 AM