I have all of my in-app purchases working fine using codeless IAP through the inspector. Now I’ve decided to set the purchase callbacks manually for OnPurchaseComplete and OnPurchaseFailed through code instead of through the inspector and I receive a compile error.
Error:
error CS0428: Cannot convert method group ‘OnPurchaseComplete_ListenerUnlockChat’ to non-delegate type `UnityEngine.Purchasing.IAPButton.OnPurchaseCompletedEvent’. Consider using parentheses to invoke the method
Here is my function definition (works through inspector):
public void OnPurchaseComplete_ListenerUnlockChat(UnityEngine.Purchasing.Product product)
{
if(product.definition.id == "unlock_chat")
{
... code
}
}
The variable:
public IAPButton button_IAPUnlockChat;
And here is how I am trying to set it (error is on this line):
button_IAPUnlockChat.onPurchaseComplete = globalManager.purchaserManager.OnPurchaseComplete_ListenerUnlockChat;
Any help would be appreciated!