Unity In-App Purchasing requires Unity Gaming Services to have been initialized before use

Yesterday I was forced to upgrade my Unity version to the latest version. In doing so, now when I load up Unity, I get the following warning :

Unity IAP: Unity In-App Purchasing requires Unity Gaming Services to have been initialized before use.

I have read the documentation provided here : Services Core SDK API

and I am not quite sure where to add this code. I do not use the codeless IAP version (I wrote code to use the
UnityEngine.Purchasing library).

In my IAPManager class I wrote, I added the code mentioned in the documentation (adding it to the start method).

I still get the warning. I even tried adding it to the very first class that gets loaded when my app starts, I still get the warning.

Is there a trick to getting this to work?

Thanks!

1 Like

Actually, the full error I am getting is :

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.

1 Like

Ok, solved my own problem. I’ll post the answer here in case it helps anyone else.

I found a file in Resources/IAPProductCatalog.json (which I don’t know where it came from as I never made it) the following configuration :

"enableCodelessAutoInitialization":true

setting it to false made the issue go away

7 Likes

@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

3 Likes

Thanks man. I appreciate the info :slight_smile:

Hi,
I have “enableCodelessAutoInitialization”:false, but still got warning.

Unity 2020.3.38 inApp 4.3.0.

Same here, I’m still getting the warning with “enableCodelessAutoInitialization” set to false. InApp 4.5.0

Hi @BIMG , @Michael_Gilbert_11 ,

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)
4 Likes

Can i use IAP with UnityServices.InitializeAsync call, but without UGS subscription?

Hi @justtime ,

Yes you can. If you need if for any other subscription-free UGS service, ex: Cloud Diagnostics, Remote config, go ahead.

Also the Transaction and TransactionFailed analytics results are supposed to be visible for free with an unpaid signup.

There is currently no IAP feature that requires a UGS Subscription, but we facilitate a few services automatically.

1 Like

This thread is now closed. Feel free to reach out via a new thread if you encounter further issue.
Thanks!