x


GUI Text Variable Counter In C#

Hi Guys :) I have a Small Question. I am Currently Making a MMORPG (that works right now) and now i need a Variable Counter In C# (Not JavaScript Because i already know it) Can Someone Help me :)?

-Yohan

more ▼

asked Apr 21 '12 at 01:28 PM

Nahoyman78 gravatar image

Nahoyman78
35 6 12 13

  1. Why bold? Not too easy on the eyes ...

  2. What do you mean by a 'variable counter'? An incrementing time display? A display of the total number of players? A health display? A counter which shows the current number of variables in use (probably not :D)? This is a very ambiguous question.

  3. I'll tell you now, because you'll get burned by other people. Unity doesn't use Javascript. It uses Unityscript. The two are very different from each other.

Apr 21 '12 at 02:20 PM Kleptomaniac

Ok xD. I need a GUIText that Counts the Current Health. Any Ideas? xD

Apr 21 '12 at 02:23 PM Nahoyman78
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Well, that totally depends on what current health system you have! But generally, assuming you already do have some manner of health system set up, the C# method is pretty much exactly the same as the JS method. Like so:

GUIText healthGUI;

void Update () {
    healthGUI.text = yourHealthVar.ToString();
}

Hope that helps, Klep

more ▼

answered Apr 21 '12 at 02:31 PM

Kleptomaniac gravatar image

Kleptomaniac
2.5k 6 12 21

OMG THANKS! :DD

Apr 21 '12 at 02:35 PM Nahoyman78

Haha, no worries. If that helped you, acknowledge by accepting my answer (ticking it). Otherwise, glad I could help. :P

Apr 21 '12 at 02:45 PM Kleptomaniac

Emm One Question. What Shall i do if i do it in a 3D Text? But Still thanks for the Health GUIText ;)

Apr 21 '12 at 03:12 PM Nahoyman78

For a text mesh, same principles apply:

TextMesh healthGUI;

void Update () {
    healthGUI.text = yourHealthVar.ToString();
}
Apr 21 '12 at 03:18 PM Kleptomaniac

Thanks :)

Apr 21 '12 at 03:20 PM Nahoyman78
(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:

x4379
x852
x211
x101
x28

asked: Apr 21 '12 at 01:28 PM

Seen: 1923 times

Last Updated: Apr 21 '12 at 03:22 PM