控制台告诉我:
cannot implicitly convert type `string' to `UnityEngine.UI.Text'
我正在尝试做到这一点,以便在使用UI应用效果(单击“应用”按钮)时,我的“金额”下降。
int moneyamount;
int isApplied;
public Text moneyAmountText;
public Text effectPrice;
public Button buybutton;
// Use this for initialization
void Start () {
moneyamount = PlayerPrefs.GetInt ("MoneyAmount");
}
// Update is called once per frame
void Update () {
moneyAmountText = "Money: " + moneyamount.ToString () + "$";
isApplied = PlayerPrefs.GetInt ("isApplied");
if (moneyamount >= 5 && isApplied == 0)
buybutton.interactable = true;
else
buybutton.interactable = false;
}
public void applyeff()
{
moneyamount -= 5;
PlayerPrefs.SetInt ("isApplied", 1);
}