Unity IAP: Unity In-App Purchasing requires Unity Gaming Services to have been initialized before use.
- Find out how to initialize Unity Gaming Services by following the documentation https://docs.unity.com/ugs-overview/services-core-api.html#InitializationExample
or download the 06 Initialize Gaming Services sample from Package Manager > In-App Purchasing > Samples.
- If you are using the codeless API, you may want to enable the enable Unity Gaming Services automatic initialization by checking the Automatically initialize Unity Gaming Services checkbox at the bottom of the IAP Catalog window
UnityEngine.Purchasing.CodelessIAPStoreListener:InitializeCodelessPurchasingOnLoad () (at Library/PackageCache/com.unity.purchasing@4.3.0/Runtime/Codeless/CodelessIAPStoreListener.cs:52)
The error is on line 52 in this file : references Library/PackageCache/com.unity.purchasing@4.3.0/Runtime/Codeless/CodelessIAPStoreListener.cs:52
I am not using the “codeless iap version”… why is this code executing? I’m guessing by upgrading my unity it added this code by default. How do I disable this codeless version? I already have a coded iap version working.
@Sparticus (I like the name) Great catch! I see the same value in my IAPProductCatalog.json and I’m not using Codeless. It appears to be a bug, I will let the team know ASAP. To your other question, the message is a strong warning only, IAP will operate without UGS initialization. There is a great article here on the topic that should help FAQ for IAP 4.2+ and adoption of UGS Services
It’s likely normal that you will still get the warning. Those checkboxes are for Codeless IAP, and don’t exempt any user from getting the warning if they don’t initialize the UGS services manually.
If you don’t want to opt in to the UGS services you won’t need to enable it. You can then ignore the warning if you don’t intend to use it. See this FAQ for information: FAQ for IAP 4.2+ and adoption of UGS Services
If you are initializing it, and you still get the warning, it could be a race condition because you initialize UnityPurchasing before calling the services InitializeAsync. If that’s the case, IAP will try to use these services before they’re ready. Don’t worry too much, we enqueue any events that would use them and they’ll be dequeued once we get the Services Initialize callback.
I don’t have much context with regards to your projects. If you are unsure about something, please give me more details such as:
Whether you are or are not using Codeless IAP
Whether you intend to use UGS services
When you call UnityServices.InitializeAsync vs UnityPurchasing.Initialize
Any strange behaviours you may be encountering (besides the warning)