I'm trying to implement IAP in my game where the user can buy 100 coins. I have used this video tutorial to implement the IAP and this works fine. I want to implement a functionaltiy where once the purchase has been made, a panel opens up stating that the purchase was successful. This is the code in the IAP manager that handles a successful purchase:
public void Coin_100()
{
BuyProductID(coin_100);
}
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
{
if (String.Equals(args.purchasedProduct.definition.id, coin_100, StringComparison.Ordinal))
{
GameManager.currentCoinScore += 100;
}
}
And here is the PurchaseButton script and I call the Coin100 method when the user click on the purchase button:
public void Coin100() {
IAPManager.instance.Coin_100();
PurchaseSuccess.SetActive(true);
}
The issue is that as soon as the the button is clicked the panel opens up. Is there any way to delay activating the panel i.e once the purchase is successful and not as soon as the button is clicked. I thought of adding a static bool to the IAP script and then in the Update function of the PurchaseButton script, check if this bool is true and then activate the panel. But this effects the performance. Can someone please help me with this?
PurchaseSuccess.SetActive(true);
afterGameManager.currentCoinScore += 100;
? \$\endgroup\$