I’m stuck in C#, I have a script for buttons which displays the cost, count and click power. But when the gold starts to reach over 10+ million the number becomes something like 1.2555e+07. I’m wanting to simple it down, so 1000 gold = 1k, 1000000 = 1 Mil. How would I go about doing this?
using UnityEngine;
using System.Collections;
public class UpgradeManager : MonoBehaviour {
public Click click;
public UnityEngine.UI.Text itemInfo;
public float cost;
public int count = 0;
public int clickPower;
public string itemName;
private float baseCost;
void Start(){
baseCost = cost;
}
void Update() {
itemInfo.text = itemName + "\ncost: " + cost + "\nPower: +" + clickPower;
}
public void PurchasedUpgrade() {
if (click.gold >= cost) {
click.gold -= cost;
count += 1;
click.goldperclick += clickPower;
cost = Mathf.Round (baseCost * Mathf.Pow (1.35f, count));
}
}
}
Is it showing the 1.2555e+07 after you divide by 1000000 or whatever amount? Because the answer to the question on the link that LeftyRighty gave should work.