Search Unity

IAP Service not found running Batchmode (2017.3.0p3)

Discussion in 'Unity IAP' started by PGI2017, Feb 4, 2018.

  1. PGI2017

    PGI2017

    Joined:
    Mar 30, 2017
    Posts:
    55
    I'm not sure how to resolve this, but when I build the project directly in Unity (Mac) the Unity Services show that IAP is enabled and running and there are no build issues.

    As soon as I try to build from the command line with -batchmode that same build is unable to verify that the IAP Services is active and the build fails wherever there is a Store reference.

    Is there a new way to setup IAP when running in batch mode with 2017.3.0p4? This was working fine under 5.6.0f3.

    Thanks
     
    Last edited: Feb 5, 2018
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you share the build pipeline code that you are using to kick off a build?
     
  3. PGI2017

    PGI2017

    Joined:
    Mar 30, 2017
    Posts:
    55
    I'm building with Jenkins (v2.89.3) running the "Invoke Unity3d Editor" with the following command line arguments:
    -quit -batchmode -buildTarget iOS -serial ##### -username ##### -password ##### executeMethod Jenkins.PerformDeviOSBuild

    I successfully use this same command, building the same code with Unity 5.6.0f3.

    I am able to successfully build and run the code using the Editor, so I know the build works. But running from command line it appears Unity is unable to verify (include?) the IAP Service in order for the build to finish without errors.
     
  4. PGI2017

    PGI2017

    Joined:
    Mar 30, 2017
    Posts:
    55
    I also just tried building it the same way using 2018.1.0b5 and I get the same results as using the 2017.3.0p4 version.
     
  5. PGI2017

    PGI2017

    Joined:
    Mar 30, 2017
    Posts:
    55
    I get this warning when building from the command line (-batchmode). From the command line build Unity isn't aware that IAP has been enabled in the Services window. When I launch the project in the Editor, the IAP service shows enabled.

    -----CompilerOutput:-stderr----------
    Assets/Plugins/UnityPurchasing/script/PurchasingCheck.cs(3,0): warning CS1030: #warning: `"Unity IAP plugin is installed, but Unity IAP is not enabled. Please enable Unity IAP in the Services window."'
    -----EndCompilerOutput---------------
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  7. PGI2017

    PGI2017

    Joined:
    Mar 30, 2017
    Posts:
    55
    But why would it work, with the same Jenkins station, building with Unity 5.6.0f3 and not with 2018.1.0b (or 2017.xxx)? Are you suggesting that there's a new permissions aspect to the Services that is preventing this with the latest version of Unity?

    To clarify, Unity attempts to build the app, but the Services is not enabled during a command line batchmode build so the IAP file fires off errors because it can't access the IAP content. Everything else Unity-wise builds except anything having to do with IAP Services (which is the only service that should be enabled).
     
    Last edited: Feb 6, 2018
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  9. PGI2017

    PGI2017

    Joined:
    Mar 30, 2017
    Posts:
    55
    This is getting ridiculous. Changing the user types didn't change anything. Could this be a timing issue with Unity after launching where if it takes too long to connect and sync up the Services that it's causing a continuation of the build to bail?
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @PGI2017 That is possible, we are continuing to investigate.
     
  11. PGI2017

    PGI2017

    Joined:
    Mar 30, 2017
    Posts:
    55
    Is it possible to introduce a delay right after Unity launches in batchmode to allow the Editor time to sync up Services?
     
  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @PGI2017 that is an area that we are investigating. Keep in mind that any fix for this would need to go through the release cycle for a future version of the Editor.
     
  13. PGI2017

    PGI2017

    Joined:
    Mar 30, 2017
    Posts:
    55
    We're returning to the older version of Unity until this is resolved.

    Is there an expected release time for the next patch or full release?
     
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We do not yet have an ETA for this issue.
     
  15. PGI2017

    PGI2017

    Joined:
    Mar 30, 2017
    Posts:
    55
    Still exists in 2018 b7.
     
  16. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Are you able to test with 2017.2.2p1 or 2017.3.1p1 (or more recent patches) ? We pushed a fix in these patches which should address this issue.
     
    Last edited: Mar 15, 2018
  17. KobayashiKeisuke

    KobayashiKeisuke

    Joined:
    Apr 4, 2018
    Posts:
    2
    This bug still exists in Unity2017.4.8f1, Unity2017.4.25f1 too.
    If I use Unity in window mode, the ServiceWindow shows UnityIAP is Enabled.
    However, using with batchmode, the editor log show an error below.
    ```
    Assets/Plugins/UnityPurchasing/script/PurchasingCheck.cs(3,0): warning CS1030: #warning: `"Unity IAP plugin is installed, but Unity IAP is not enabled. Please enable Unity IAP in the Services window."
    ```

    It seems to be connect Unity License Server to check whether UnityIAP is enabled when Unity.app works up.
    But, in batchmode, this process doesn't worked. So, build is failed.


    Are there any solutions to be enable UnityIAP in batchmode ?
     
  18. raofr

    raofr

    Joined:
    Jun 2, 2017
    Posts:
    1
    This bug still exists in Unity2018.3.9
    We cannot integrated UnityIAP Unity Analytics. The error log is the same as KobayashiKeisuke
     
  19. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please provide your batchmode syntax.
     
  20. phongathena

    phongathena

    Joined:
    Apr 5, 2019
    Posts:
    5
    I'm also encountering this problem for both iOS and Android. Unity 2018.3.14f1.

    Assets/Plugins/UnityPurchasing/script/PurchasingCheck.cs(3,0): warning CS1030: #warning: `"Unity IAP plugin is installed, but Unity IAP is not enabled. Please enable Unity IAP in the Services window."

    And this makes the IAP functionality not working in the final build.

    My setup is Gitlab CI with self-hosted build machine.

    I also think that this may relate to "Editor time to sync up Services" as other users said (?!)

    This is the syntax:
    /Applications/Unity/Hub/Editor/2018.3.14f1/Unity.app/Contents/MacOS/Unity -nographics -quit -batchmode -logFile -buildTarget Android -executeMethod Aegis.Build -projectPath xxxx -buildPlatform android -buildOutput xxxxxx -gameVersion 1.1.0 -gameBuildNumber 47
     
    Last edited: Jun 27, 2019
  21. phongathena

    phongathena

    Joined:
    Apr 5, 2019
    Posts:
    5
    It worths mentioning that when I log into the build machine, opening the project with Unity Editor, the IAP setting is enabled. So there must be something wrong with batch mode.
     
  22. phongathena

    phongathena

    Joined:
    Apr 5, 2019
    Posts:
    5
    My current workaround is to explicitly define UNITY_PURCHASING in Scripting Define Symbols.
     
  23. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I am not able to reproduce with the Sample IAP Project here: https://forum.unity.com/threads/sample-iap-project.529555/ When I use the above syntax I don't receive the error, but I'm testing in the existing project file system, outside of source control . However, we believe it may have something to do with the /Library folder. Typically you would .ignore this folder, but something to check. Update - It looks like someone submitted a repro project via issuetracker, so I will be following up.
     
    Last edited: Jun 27, 2019
  24. phongathena

    phongathena

    Joined:
    Apr 5, 2019
    Posts:
    5
    Yes I was investigating the potential issue with Library folder not being put into the repository too.

    Another fact: testing on local dev machine seems to work. Here's the step:

    - Fresh clone the repo from git to my local machine. The Library folder does not exist of course (coz it's not put on git).
    - Start the Unity command line.
    - IAP not enabled warning is shown. But APK is built successfully. But IAP functionality does not work.
    - At this point, the Library folder is already generated.
    - Start the Unity command line again.
    - No more "IAP not enabled" warning. And the APK works correctly with IAP.

    I made a script on the build machine to cache the Library folder right after the build machine completed. Then in the next pipeline triggers, my script copies that cached Library folder into the newly cloned repo before starting the Unity command line, but Unity still see that IAP not enabled warning. Weird, I still don't know why.

    So until now my only workaround solution is to explicitly declare UNITY_PURCHASING in Scripting Define Symbols.
     
  25. chyrho

    chyrho

    Joined:
    Nov 1, 2016
    Posts:
    3
    We recently upgraded from 2017.4.22 to 2018.4.10 and started to get this issue with our automated build system. The project builds fine when done interactively. When Unity was launched with batch mode and a fresh pull of code (i.e. no Library folder), I got "Unity IAP plugin is installed, but Unity IAP is not enabled. Please enable Unity IAP in the Services window" from PurchasingCheck.cs. It's exactly the same issue as described by phongathena. The problem went away when I launch Unity in batch mode again with Library folder already existed.

    The Unity installation on build machine has appropriate Unity account associated. When Unity is opened interactively, I can see IAP enabled in services window. I even added -username and -password parameters to the command line and the result is still the same.

    UPDATE: this issue is actually not related to batch mode. It happens 100% when project is opened without Library folder, either Unity is launched interactively or with batch mode.
     
    Last edited: Oct 9, 2019
  26. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Your work around sounds like the correct approach for now until we can address this issue. We have the next release due out hopefully this week, we will check on this for the next release. You'll also want to test this next release to see if is still occurs.
     
  27. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    If it helps, this does not look to occur with Unity 2019. I removed the Library folder and loaded and ran my IAP project without issue. Unity rebuilds the Library folder successfully at load.