SO when I reach $1000 in my idle game, i want to to turn into $1K, same with the millions. But there are no errors and it doesnt convert? here is the code. using UnityEngine;
using System.Collections;
public class CurrencyConverter : MonoBehaviour {
private static CurrencyConverter instance;
public static CurrencyConverter Instance{
get{
return instance;
}
}
void awake(){
CreateIntance();
}
void CreateIntance(){
if (instance == null) {
instance = this;
}
}
public string GetCurrencyIntoString(float valueToConvert, bool currencyPerSec, bool currencyPerClick){
string converted;
if (valueToConvert >= 1000000) {
converted = (valueToConvert / 1000000f).ToString ("F3") + " M";
} else if (valueToConvert >= 1000) {
converted = (valueToConvert / 1000f).ToString ("F3") + " K";
} else {
converted = "" + valueToConvert;
}
if (currencyPerClick == true) {
converted = converted + " tpc";
}
return converted;
}
}
IS there something wrong in the code? Plz reply with the best feedback as possible, thanks.