I have an empty gameobject called MoneyManager. I attached a C# script to it called money. Inside that script I have a really simple method called takemymoney.
Code: Select all
public void takemymoney(int takemoney)
{
currentMoney = currentMoney - takemoney;
}
What I hoped to accomplish is upon saying you'll buy something in the dialogue system (clicking 'yes' as a response when prompted) the method will run, subtracting an amount from my int currentMoney.
So, I used SendMessage(takemymoney, 5, MoneyManager) in the sequencer on the node after you agree to buy the item. This gives me the following error:
Dialogue System: Lua code 'return SendMessage(takemymoney, 5, MoneyManager)' threw exception 'Invoke function call on non function value.'
UnityEngine.Debug:LogError(Object)
Any suggestions on how to accomplish what I'm attempting?