Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 biohazard · Jul 27, 2011 at 11:46 AM · javascriptcoroutinetextmesh

Updating a TextMesh buggy?

I'm using a for-loop to assign RP/M values to a textmesh, it is updating once per second but keeps getting weird values.

the highest RPM value in my records is a 4 digit number and it goes up to way more than that...

example :

 myEpicTextMesh.Text = int.Parse(MyEpicRpmArray[EPIC]).ToString(MyEpicRpmArray[EPIC] + " RPM");


doing this in a coroutine once per second getting weird numbers..

any advice on fixing this?

any help is apreciated

thanks in advance,

bio

Comment
Add comment · Show 13
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 biohazard · Jul 27, 2011 at 11:48 AM 0
Share

if you find spelling errors in the source you can keep it

avatar image Waz · Jul 27, 2011 at 12:17 PM 0
Share

Why all that conversion yoga? Do you mean something other than:

 myEpicText$$anonymous$$esh.Text = $$anonymous$$yEpicRpmArray[EPIC] + " RP$$anonymous$$";

?

avatar image Waz · Jul 27, 2011 at 12:25 PM 1
Share

And it's poor form to keep reaching for "Bug in Unity?" every time you're stumped. There is a proverb about tradespersons and their tools in most cultures.

avatar image biohazard · Jul 27, 2011 at 12:35 PM 0
Share

thank you for the constructive answer

i just doubt that my car runs at 200.000 rounds per $$anonymous$$ute but i might be wrong...

avatar image biohazard · Jul 27, 2011 at 12:52 PM 0
Share

11.000 km/h....

seems legit :)

and yes, i DID check the file and those values are not in there

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Waz · Jul 27, 2011 at 02:22 PM

Your quoted code does this:

  1. Implicitly convert MyEpicRpmArray[EPIC] to a string in order to...

  2. Pass that string to int.Parse to convert (back) to an integer.

  3. Again convert MyEpicRpmArray[EPIC] to a string in order to add " RPM" to it.

  4. Uses that value as a string format specification to int.ToString

  5. int.ToString formats the int from step 2 according to the string from step 3

  6. Produces a weird mess, since step 3 does not produce a sensible format.

So try instead simply:

 myEpicTextMesh.text = MyEpicRpmArray[EPIC] + " RPM";
Comment
Add comment · Show 3 · 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 biohazard · Jul 28, 2011 at 07:11 AM 0
Share

if this really was my issue, i will punch myself..

avatar image Waz · Jul 28, 2011 at 10:05 AM 0
Share

How's the bruise healing?

avatar image biohazard · Jul 28, 2011 at 10:44 AM 0
Share

didn't try it yet, busy with something else at the moment -.-

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

changing a coroutine's argument at the coroutine's runtime? 1 Answer

Keeping track of time? 4 Answers

A node in a childnode? 1 Answer

Increment X every one second. 2 Answers

FPS keep a loadout 0 Answers


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