Question by
tyranpro557 · Aug 04, 2016 at 05:39 PM ·
moneymoneysystem
help error CS0428: Cannot convert method group `ToString' to non-delegate type `string'. Consider using parentheses to invoke the method
Hey im having an error with this code and am not sure how to fix it
error CS0428: Cannot convert method group ToString' to non-delegate type string'. Consider using parentheses to invoke the method
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class playerMoney : MonoBehaviour
{
public int money;
public Text moneyText;
// Use this for initialization
void Start()
{
money = 10;
moneyText.text = money.ToString;
}
// Update is called once per frame
void Update()
{
}
public void addMoney(int moneyToAdd)
{
money += moneyToAdd;
moneyText.text = money.ToString;
}
public void subtractMoney(int moneyToSubtract)
{
if (money - moneyToSubtract < 0)
{
Debug.Log("Not EnoughMoney!");
}
else
{
money = moneyToSubtract;
moneyText.text = money.ToString;
}
}
}
Comment
Best Answer
Answer by tyranpro557 · Aug 04, 2016 at 05:40 PM
Nevermind if fixed it error CS0428: Cannot convert method group ToString' to non-delegate type string'. ***Consider using parentheses to invoke the method***