- Home /
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
if you find spelling errors in the source you can keep it
Why all that conversion yoga? Do you mean something other than:
myEpicText$$anonymous$$esh.Text = $$anonymous$$yEpicRpmArray[EPIC] + " RP$$anonymous$$";
?
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.
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...
11.000 km/h....
seems legit :)
and yes, i DID check the file and those values are not in there
Answer by Waz · Jul 27, 2011 at 02:22 PM
Your quoted code does this:
Implicitly convert MyEpicRpmArray[EPIC] to a string in order to...
Pass that string to int.Parse to convert (back) to an integer.
Again convert MyEpicRpmArray[EPIC] to a string in order to add " RPM" to it.
Uses that value as a string format specification to int.ToString
int.ToString formats the int from step 2 according to the string from step 3
Produces a weird mess, since step 3 does not produce a sensible format.
So try instead simply:
myEpicTextMesh.text = MyEpicRpmArray[EPIC] + " RPM";
didn't try it yet, busy with something else at the moment -.-
Your answer
Follow this Question
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