Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

IAP fails in Unity Cloud Builds

Discussion in 'Unity IAP' started by alan-lawrance, Dec 18, 2020.

  1. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    299
    Unity: 2018.4.30
    IAP Package: 2.0.6

    Build local, deploy to Google Play Games, and IAP works as expected.

    Exact same repo, built using Unity Cloud Build, deploy to Google Play Games, IAP fails. Appears to be exception in the InitializePurchasing boilerplate on this line:

    var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());

    Seems to have been some discussion of IAP and Unity Cloud Build issues years ago, and I tried the suggestions I found:

    1. define UNITY_PURCHASING
    2. re-import IAP package
    3. Disable then Re-enable IAP

    But same results.

    It seems this must be a build problem with Unity Cloud Build and IAP, or I've configured something incorrectly. Everything else works on the Unity Cloud Build version, such as logging into Google Play Games.

    The work-around is to just make the build locally, but this messes up the automation process we have. Would really like to get to the bottom of this.
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    10,454
    Can you try with IAP 2.2.5 that was released this week? 2.0.6 is the package version of the In App Purchasing library, 2.2.5 is the IAP version that is listed under menu Window/Unity IAP/IAP Updates...
     
  3. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    299
    So I imported 2.2.5 from the asset store, and unexpectedly only 1 meta file got changed (Assets/Plugins/UnityPurchasing/Editor.meta -- the licenseType changed from Pro to Store).

    This is odd since I had previously installed from Window > Package Manager > In App Purchases > Version 2.0.6.

    In fact the package manager still shows 2.0.6 as the In App Purchasing version:

    upload_2020-12-18_11-49-13.png

    So I am a bit confused -- is there a difference between the In App Purchasing 2.0.6 package and what gets installed from 2.2.5? It appears the answer is no, after going through install process twice to be sure.

    Or did something go wrong with my 2.2.5 install (didn't see any errors though).
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    10,454
    Unity IAP requires two components, a Package Manager package 2.2.1, and the asset package 2.2.5. I just confirmed that these are available starting with Unity 2018.4.18f and higher.
     
  5. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    299
    OK, what I realize now is doing "Import" from the IAP Services tab has already installed the latest IAP Plugin (2.2.5). So basically I was already up to date as far as using 2.2.5 Plugin and the 2.0.6 core package. I tried updating to the latest version in the package manager (2.2.1) and it only updates the version in manifest.json. Which begs the question what actually changed in the iap package between 2.0.6 and 2.2.1.

    None of this helps solving the issue of why Unity Cloud Builds fail with IAP though, as I'm already up to date on the lastest IAP plugin and package.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    10,454
    Understood, but you will want to ensure you have the latest package manager version installed which is 2.2.1. Restore across devices doesn't work with package 2.0.6, a common complaint from customers. Users expect purchases on one device to be available across all their devices. But to your point, we didn't make any changes with regard to Cloud Build or batch build behavior, so you likely won't see any difference with the latest version. We wanted to rule it out but it is not critical to our investigation. We are checking here but we probably won't have any updates until January.
     
  7. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    10,454
  8. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    299
    The problem resolved after I updated the IAP package from 2.0.6 (which is the verified package for 2018.4) to the latest 2.2.1. My best guess is that 2.2.5 Plugin depends on 2.2.1 being installed, but for some reason building local wasn't problematic with 2.0.6 (maybe importing the 2.2.5 plugin did something sneaky).

    To sum up: If you are using 2018.4, make sure you use 2.2.1 of the package if you are using 2.2.5 plugin. It sounds like the plugin and package are going to be merged in the future, which definitely sounds like a good idea.
     
    nicholasr likes this.
unityunity