Changing prices after a certain point?

I’m prototyping a game similar to adventure capitalist and I’ve ran into a slight problem. Whenever my prices surpass 10,000,000, unity changes the price to 1.xxxxx e + 0x, instead of saying 10,234,502 for example. I want to setup something to say when the price passes 1,000,000 to change it to x.xxx million and then at 1,000,000,000, it will change to x.xxx billion, and so on. How would I go about setting this up? And I don’t want to show decimals under 1,000,000.

@ltrout1999

my first thoughts on this would be to check for it to be >= to 1,234,567 then multiply by 1X10^(-3*counter) this counter will be how many time you have performed this already +1 so first time it will be 1 so it will multiply by .001 and the second .000001, etc… This will give you 1,234.567 first time. Then Mathf.Round, or Floor, or Ceil which every you want to use. this will give you 1,234. Then multiply by .001 once more and you will get 1.234. keep a count of how many times this condition is met and create a case switch to add either + “million” or +“billion”, etc.

I have written a game similar to this, and I leave the cash alone so unity and the data goes smoothly.

Instead I use the game script (in update frame) to send the cash value to my currency converter script which displays the data such as “XX.xx Billion”.

Basically you just need an if/else statement to check the amount and if it’s over X,XXX,XXX,XXX then divide by 1,000,000 and alter the UI to display “XXX.xx Billions”.

Also remember to start with the largest amount you wish to code in (Ex: Decillion) and if it’s smaller, then use an else statement to check the next amount and just keep going down the line.