Search Unity

Unity IAP Compile errors

Discussion in 'Unity IAP' started by martin_unity660, Feb 15, 2019.

  1. martin_unity660

    martin_unity660

    Joined:
    Feb 15, 2019
    Posts:
    22
    Unity IAP verison 1.20.1
    Unity Version 2018.3.4f1

    Hi,

    I'm evaluating at the moment multiple IAP solutions for our unity project and I run into some compile errors with Unity IAP.

    I enabled the services for IAP and Analytics in Unity services. Then I clicked on the button to import the IAP plugin. After importing I ran the installer for the UnityChannel and UnityIAP packages.

    This will result in a Unity error:

    Assets\Plugins\UnityPurchasing\Editor\UnityIAPInstaller.cs(496,38): error CS0618: 'PlayerSettings.cloudProjectId' is obsolete: 'cloudProjectId is deprecated, use CloudProjectSettings.projectId instead'

    And 44 compile errors like :

    \Assets\Plugins\UnityPurchasing\script\CodelessIAPStoreListener.cs(12,45,12,59): error CS0246: The type or namespace name 'IStoreListener' could not be found (are you missing a using directive or an assembly reference?)
    \Assets\Plugins\UnityPurchasing\script\CodelessIAPStoreListener.cs(79,16,79,32): error CS0246: The type or namespace name 'IStoreController' could not be found (are you missing a using directive or an assembly reference?)
    \Assets\Plugins\UnityPurchasing\script\IAPDemo.cs(31,39,31,53): error CS0246: The type or namespace name 'IStoreListener' could not be found (are you missing a using directive or an assembly reference?)

    I removed the plugin and used the Reimport button in the IAP services tap to import the plugin again. Now I
    fixed the unity error in UnityIAPInstaller.cs by changing 'PlayerSettings.cloudProjectId' to 'CloudProjectSettings.projectId'. After doing that a Window pops up:


    Hitting the install button will result in:

    The OK button will remove the whole UnityPurchasing folder from the plugin directory.

    I tried now already to import the packages UnityIAP and UnityChannel by double clicking and with Assets->ImportPackage but both will end up with the compiler errors mentioned above.

    I restarted Unity, Enabled/Disabled the IAP service, Closed and Opened the Services Window and rebooted Windows. The result is always the same.
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. martin_unity660

    martin_unity660

    Joined:
    Feb 15, 2019
    Posts:
    22
    In an empty test project or with the SurvivalShooter_IAP_Demo the installation process seems to work fine. But in our project the installation/reinstallation get stuck after Step 2 in your IAP troubleshooting guide. The prompt from step 3 never appears instead I get the error I mentioned in my first post:

    Assets\Plugins\UnityPurchasing\Editor\UnityIAPInstaller.cs(496,38): error CS0618: 'PlayerSettings.cloudProjectId' is obsolete: 'cloudProjectId is deprecated, use CloudProjectSettings.projectId instead'

    To what version of the project you would recommend to revert? One month a go, two month a go?
     
    Last edited: Feb 18, 2019
  4. martin_unity660

    martin_unity660

    Joined:
    Feb 15, 2019
    Posts:
    22
    Including Unity IAP in the Package Manager fixed the second issue. The compile error in UnityIAPInstaller.cs has to be fixed manually.
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I simply meant the the version just prior to importing, to "Undo" the import as how would I know your project differences from a month or two months? You will need to find the differences in your project vs a new project with regard to the error. This project is properly enabled for Analytics, right? Enabled in the Services window (menu Window/Services or Window/General/Services)
     
  6. IlisanVlad

    IlisanVlad

    Joined:
    Dec 3, 2017
    Posts:
    30
    I solved this problem :). I am not sure what did it but I am going to tell you the steps I took.
    Go to Assets/Plugins/ and delete UnityChannel & Unity Purchasing. After that go to Services tab and click on In-App Purchasing, if it's enabled you should have an import button, click it. You should get this warning

    Assets\Plugins\UnityPurchasing\Editor\UnityIAPInstaller.cs(496,38): error CS0618: 'PlayerSettings.cloudProjectId'
    is obsolete: 'cloudProjectId is deprecated, use CloudProjectSettings.projectId instead'

    Double click it and change PlayerSettings.cloudProjectId to CloudProjectSettings.projectId. After compiling you should get asked to install Unity IAP...CANCEL IT. Now go to Package Manager, click on In App Purchasing, expand the tab by clicking on the little arrow, click on See all versions and select version 2.0.5 (that's what I choose), click Update. I restarted Unity here.
    After that, I am not sure but I either click on reimport from services, got the same warning, fixed it and clicked on Install to the IAP pop up(the most likely)...or, I upgraded to 2.0.6 from Package Manager.

    I hope this works for you too :)
    Feel free to ask any questions you have.
     
    DerpMooseFish likes this.
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  8. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    142
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    No, you are free to add receipt validation or any customization that you want to the sample. For the Codeless sample, you would want to modify IAPButton.cs. And please don't cross post to get your point across, we hear you.
     
  10. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    142
    It just seems that that if it doesnt perform receipt validation , then it wont support subscriptions, which means to me that it only half works
     
  11. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We fully support subscriptions, separate from receipt validation.