IAP Version 2.0 Breaks UnityEngine.Purchasing

Platform: Mac
Editor Version: 2019.3.2f1
IAP Package Version: 2.0.6

I’d been being bothered for months by the editor to update IAP package to the latest version, 2.0. I finally gave in and now have IAP 2.0.6. My previous IAP version was working fine and has a build deployed and live. I have a custom C# script connecting to it via UnityEngine.Purchasing. Note: IAP was located in the Plugins directory previously and is in the Packages directory now. After updating, the former had to be deleted in order to remove a bunch of C# errors. Now that it’s gone, there are errors in my C# class:

  • The name “StandardPurchasingModule” does not exist…
  • The name “AppleAppStore” does not exist…
  • Then name “GooglePlay” does not exist…
  • The type or namespace “IAppleExtensions” does not exist…

I’ve searched several times and found now documentation on the latest equivalents / locations of these classes / interfaces.

Has anyone else encountered / resolved this issue?

First step should be make a fresh empty project and import the packages in question.

If you can do that and trigger the bug, turn around and instantly file it with Unity. They do fix stuff like this.

If not, then start investigating how your game differs from the new test empty project.

Have you encountered this issue or something like it? Starting an empty project isn’t a viable course of action for debugging issues in a completed app.

This is just standard engineering: when you have a problem you don’t understand, eliminate half of your problem space, in this case your game.

If it suddenly works you can be fairly confident the problem is in your game.

If it doesn’t work, well, you know it’s not gonna work in your game, so you can stop messing with your game because that’s not where it is!!

Other things are to google the missing APIs. Maybe they changed names. Maybe they moved somewhere else? Try using them in the new tiny project (just use them trivially)… do they exist? Every single step you do will give you more intel about the problem.

I’m the Senior Support Engineer for Unity IAP. The advice is correct, always compare to a brand new project and import via the the Services window in the Unity Editor. You’ll likely see what you missed. So a little background. IAP currently requires both a Package Manager package and an Asset package, we are working to make it all Package Manager soon. The latest IAP Version is 2.0.0 (version via menu Window/Unity IAP/IAP Updates), and the latest Package Manager associated version is 2.1.1 (a bit confusing, granted). So in your case, you’ll likely want to revert to a back-up/source control version prior to your update. Then update IAP via the Services window, or via the menu option.

2 Likes

Thank you for the information, Jeff. The import via Services window is new information. Appreciate that.

Do you know if documentation exists on the IAP (and UDP) packages? Seeing the documents would be a big help.

Unfortunately the last doc release was with Unity 2018. Once we move to the all-Package Manager release, we will be updating the documentation. This should help Unity - Manual: Configuring for Google Play Store and Unity - Scripting API: UnityPurchasing

OK. Thanks again, Jeff!