Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Nahoyman78 · Apr 21, 2012 at 01:28 PM · c#variablerpgcounterc

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

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Kleptomaniac · Apr 21, 2012 at 02:20 PM 0
Share
  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.

avatar image Nahoyman78 · Apr 21, 2012 at 02:23 PM 0
Share

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

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Kleptomaniac · Apr 21, 2012 at 02:31 PM

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

Comment
Add comment · Show 8 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Nahoyman78 · Apr 21, 2012 at 02:35 PM 0
Share

O$$anonymous$$G THAN$$anonymous$$S! :DD

avatar image Kleptomaniac · Apr 21, 2012 at 02:45 PM 0
Share

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

avatar image Nahoyman78 · Apr 21, 2012 at 03:12 PM 0
Share

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

avatar image Kleptomaniac · Apr 21, 2012 at 03:18 PM 0
Share

For a text mesh, same principles apply:

 Text$$anonymous$$esh healthGUI;
 
 void Update () {
     healthGUI.text = yourHealthVar.ToString();
 }
avatar image Nahoyman78 · Apr 21, 2012 at 03:20 PM 0
Share

Thanks :)

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Using a Derived property on a Derived Class 0 Answers

[C#] Is there a way to call static variables directly, independent from parent class? 3 Answers

GetComponent, What is it ? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges