system
1
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
Waz
2
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";