Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity IAP not finding StandardPurchasingModule or IAppleExtensions

Discussion in 'Unity IAP' started by MoonBoop, Jun 25, 2020.

  1. MoonBoop

    MoonBoop

    Joined:
    Apr 21, 2016
    Posts:
    6
    I've recently upgraded my project to 2019 lts from 2018.1f1. So far I've had some trouble getting the project working due to packages needing updates, but they're now working well now aside from Unity IAP.

    I don't know what is wrong with it.
    I'm getting these errors:

    Code (CSharp):
    1. Assets/Scripts/Shop/ShopManager.cs(235,53): error CS0103: The name 'StandardPurchasingModule' does not exist in the current context
    2. Assets/Scripts/Shop/ShopManager.cs(297,61): error CS0246: The type or namespace name 'IAppleExtensions' could not be found (are you missing a using directive or an assembly reference?)
    I am importing 'UnityEngine.Purchasing' and it seems to work for every other member of Purchasing apart from StandardpurchasingModule and IAppleExtension.

    Any help would be much appreciated.
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. Sabre-Runner

    Sabre-Runner

    Joined:
    Mar 28, 2013
    Posts:
    5
    I have the same issue now. I am developing a package that depends on Purchasing but when I remove everything and reimport it, I still get the same errors for IAppleExtensions and StandardPurchasingModule.
     
  4. DigitalDurian

    DigitalDurian

    Joined:
    May 21, 2019
    Posts:
    2
    I also have the same issue. Already removed everything and reimported it
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please compare to a new project and import IAP, do you see the same thing? Keep in mind that IAP requires a Package Manager component and an Asset component. Do not add/remove anything from Package Manager, allow the installer to handle it. Confirm what IAP asset version you are using by going to Window/Unity IAP/IAP Updates... and also show your In App Purchasing package version in Package Manager.
     
  6. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    164
    I had the same problem.

    In order to get it to properly update and work again I had to comment out my own IAP code, so the code could compile again. Then, when my code compiled THEN I was able to properly update the Unity Purchasing plugin (both the package AND the asset components). And then when that was done I could put my own IAP code back in.

    Technically, my code worked "all along", but the Unity Purchasing plugin was unable to update when I was referencing the Unity Purchasing code, for some reason.

    Also, I manually had to delete the "Assets/Plugins/UnityPurchasing~" folder before it would properly clean prior to updating.
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Ah yes. If you remove the plugin before reinstalling, you need to ensure that any code you have left can still compile, or the upgrade may fail. Your project needs to build prior to the install (or upgrade)
     
    Flarup likes this.
  8. DigitalDurian

    DigitalDurian

    Joined:
    May 21, 2019
    Posts:
    2
    Hey, I solved my problem:). Turned out, I have to validate analytics before creating IAP Scripts. To validate analytics simply press play on on unity editor. Have to remove the IAP scripts before pressing play button (because of the error).

     
    Last edited: Dec 15, 2020
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Interesting! Apparently some serialization may be occurring, I would need to test and confirm.
     
  10. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    From what I recall, you might also want to be sure you log in at least once into your analytics Dashboard at least once to properly validate them. You can access this link "Go To Dashboard" from the Service Settings (in Project Settings in 2020.1 and up, in the Service Window in 2019.4 and below).
     
  11. protoCorey

    protoCorey

    Joined:
    May 4, 2021
    Posts:
    13
    I'm having this issue with 3.1.0 IAP and unity 2020.2.7f1 (also upgraded to 2020.3.6f1). What assemblies will need to be referenced? I'm referencing UnityEngine.Purchasing and UnityEngine.Purchasing.Store.

    I'm removed it, installed it upgraded it, upgraded unity. It simply is not allowing me to compile anything using StandardPurchasingModule or GooglePlayStoreModule. I've also tried running it (verifying analytics) and logged into the dashbaord as suggested.
     
  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please share more information. Are you already using asmdefs? I believe you also need to reference Security and SecurityStub.
     
  13. protoCorey

    protoCorey

    Joined:
    May 4, 2021
    Posts:
    13
    Yep, using asmdefs. This was building and running until it randomly stopped building. Then it built correctly again (no idea why) and then it stopped compiling again (with nothing more than a null check change) and hasn't built since yesterday arvo, so there is definitely something wrong in Unity's backend with how this purchasing module is processed for building by the editor. I just tried Security and SecurityStub but I'm getting the same result.

    Edit: So for clarity, it WAS building with the exact combination of defs (minus the security) prior to it suddenly failing.

    This is the current refs

    upload_2021-5-5_9-9-37.png
     
    Last edited: May 5, 2021
  14. protoCorey

    protoCorey

    Joined:
    May 4, 2021
    Posts:
    13
    Well maybe a better screenshot that actually shows the whole text

    upload_2021-5-5_9-13-58.png
     
  15. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You need to find out what's changing. Typically things don't "randomly" stop working. You might want to compare to a new project, import IAP, and see if you see the same thing.
     
  16. protoCorey

    protoCorey

    Joined:
    May 4, 2021
    Posts:
    13
    Typically things don't "randomly" stop working.

    Well yes, but that's why the only thing that makes sense is that it's an internal issue because literally nothing changed except a null check and rolling the code back to when it was working did nothing to fix the build. The same configuration worked before over multiple compiles. Then a null check was added and it hasn't built since. There is nothing to compare it to. I've reinstalled IAP, comparing it to a new project is pointless (firstly because it's a large framework and simply not even remotely comparable to a new project) but the other projects that are building are using the exact same settings.

    When "reinstall the IAP" is frequently the fix, surely that should be sending alarm bells off over there. Something is happening with the process and it certainly doesn't seem to be configuration based. have you got anything practical to try other than "compare it an incomparable setup"? This is a huge blocker for me right now.
     
  17. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    What null check? What issue are you having? You haven't shared an error or steps to reproduce.
     
  18. protoCorey

    protoCorey

    Joined:
    May 4, 2021
    Posts:
    13
    the error is "Unity IAP not finding StandardPurchasingModule" the focus of this thread. There is no error other than it not finding this class, the steps to reproduce are "try to build and it won't" what more could I possible share other than the assembly references and what versions I have installed? If there is something else specific that I can share let me know I'll be happy to provide it to figure out what's going on.

    the null check was in a completely unrelated section of code that is just checking if an argument being passed is null. It's not relevant to the cause of the issue. It was just me saying that the only change from building to not building is a completely innocuous piece of code. So what I was trying to say then is there was nothing to compare between "building" and "not building" because there WAS no configuration changes therefore nothing to compare.
     
  19. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I am able to reproduce, it's even easier than you describe. Simply creating an empty asmdef definition triggers the error. Sorry for the confusion. For me, I had to add many of the UnityEngine.Purchasing.* references to clear all the errors.

    AsmDef.png
     
    Last edited: May 6, 2021