When i click on the IAP button in the editor i get these errors: And when i publish the game and press the button on the phone nothing happens. Script: Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Purchasing; public class SubManager : MonoBehaviour { public GameObject panel; public void OnPurchaseComplete(Product product) { if (product.definition.id == "subscription") PlayerPrefs.SetInt("Sub", 1); panel.SetActive(false); Debug.Log("Purchase complete"); } public void OnPurchaseFailure(Product product, PurchaseFailureReason reason) { Debug.Log("Purchase of product " + product.definition.id + " failed because " + reason); } } I have updated Unity IAP to the latest version but it didn't help. Also I imported the catalog to Google Play Developer Console.
The error messages are indicating two things, 1) You are modifying a list while iterating through it and 2) you haven't got an active IAPButton or IAPListener in the scene when the purchase callback fires. So not directly connected with the code you posted. Edit: On second thoughts, it could be line 14, where you deactivate the panel, which is the cause of the 2nd error.
Thank you! On the panel that I deactivated was that script, I replaced it to another object and this fixed all the errors