Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

How to set codeless IAPButton OnPurchaseComplete callback through code

$
0
0
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!

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>