Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Purchasing: the name StandardPurchasingModule does not exist in current context.

Discussion in 'iOS and tvOS' started by Voloda2, Feb 19, 2017.

  1. Voloda2

    Voloda2

    Joined:
    Jan 7, 2017
    Posts:
    5
    Code (CSharp):
    1. using System;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Purchasing;
    5.  
    6.  
    7. // Deriving the Purchaser class from IStoreListener enables it to receive messages from Unity Purchasing.
    8. public class Purchaser : MonoBehaviour, IStoreListener
    9. {
    10.  
    11. public void InitializePurchasing()
    12.     {
    13.         // If we have already connected to Purchasing ...
    14.         if (IsInitialized())
    15.         {
    16.             // ... we are done here.
    17.             return;
    18.         }
    19.  
    20.         // Create a builder, first passing in a suite of Unity provided stores.
    21.         var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
    I have some errors.

    The name StandardPurchasingModule.Instance does not exist in current context.
    The type or namespace IAppleExtensions could not be found

    xamarin studio 6.1.5 on osx

    What is wrong?
     
    IgorAherne and BAIZOR like this.
  2. Voloda2

    Voloda2

    Joined:
    Jan 7, 2017
    Posts:
    5
    UnityPurchasing Class is available to compiler and runtime when Unity IAP is enabled in Editor's Services window. So I enabled and it solved problem. Unity why do you use so absurd solutions?
     
  3. ev3d

    ev3d

    Joined:
    Apr 19, 2013
    Posts:
    327
    I am getting this same error but i DO have IAP enabled

    Screenshot 2017-02-23 at 01.32.14 PM.png
     
    F3ND1MUS and BAIZOR like this.
  4. Skyboard_Studios

    Skyboard_Studios

    Joined:
    Jul 20, 2013
    Posts:
    51
    When you hit the Reimport button you will see that in your Plugins\UnityPurchasing folder you have a singular file that you can further import.

    On import you will see



    Interesting how I did this a couple times as I had the same error as you and nothing worked until I ran the UnityIAP manually...

    Hope that helps.

    Update in 2018 I ran across this anoying message saying must update.. and I ignored it for a few months... and then just today I decided to walk down the road up updating my IAP and I had to delete the UnityPurchasing Folder / restart Unity.. / Import the Asset from the Above Image. / then manually importing the secondary asset that is in the root of the UnityPurchasing directory.






    This last go of reupdating took a couple tries and I had to per persistent. Felt like at least 3 cycles of the "Hey your IAP is outdated... You want to update?" dialogues.... But at this momement all seems ok.
     
    Last edited: Dec 15, 2018
  5. zero_null

    zero_null

    Joined:
    Mar 11, 2014
    Posts:
    159
    Skyboard_Studios likes this.
  6. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    816
    This worked for me too...
    But I require to manually import both Unity Packages: UnityPurchasing and UnityConnect
     
    Skyboard_Studios and Loomabox like this.
  7. sarthakshah

    sarthakshah

    Joined:
    Jun 27, 2013
    Posts:
    3
    Skyboard_Studios likes this.
  8. kreso

    kreso

    Joined:
    Sep 7, 2013
    Posts:
    118
    [EDIT: solved]: Wow, I was using UnityPurchasing instead of 'StandardPurchasingModule' for getting the Instance. I guess the code for IAP changed slightly sometime in the past, and I wasn't paying attention to this. All is well now.

    ---

    I noticed IAP wasn't working on Android (after making an update to my game), so I went to the service tab and it said it has an update for IAP. Suddenly it stopped working, and ow my code no longer compiles (even though it worked very fine before).

    Problem that I keep getting is:
    UnityEngine.Purchasing.UnityPurchasing does not contain a definition for 'Instance'




    When I inspect the DLL, I simply do not see the freakin code in it for Instance().
     
    Last edited: Apr 25, 2018
  9. mattbrandmm

    mattbrandmm

    Joined:
    Jun 5, 2018
    Posts:
    65
    I am having this same issue in 2018.2.7:

    The name StandardPurchasingModule.Instance does not exist in current context.
    The type or namespace IAppleConfiguration could not be found
    The type or namespace IAppleExtensions could not be found

    I tried removing and reinstalling the In App Purchasing package in the Unity Package Manager, to no avail.

    The solution that @SkyboardSoftware posted is no longer relevant, as with Unity Package Manager you can no longer hit a button to reimport, and you can no longer import with options to select/deselect.

    Anyone know what to do?
     
    Last edited: Sep 7, 2018
    meghs91 likes this.
  10. AlCaTrAzzGames

    AlCaTrAzzGames

    Joined:
    May 17, 2017
    Posts:
    16
    make sure that after turning on IAP under services, that you import the package as well. ran into the same issue on 2018.2.5f1 here, this fixed it up for us

     
    IgorAherne likes this.
  11. mattbrandmm

    mattbrandmm

    Joined:
    Jun 5, 2018
    Posts:
    65
    Yes I did that. Thank you.

    The solution ended up being to comment out the lines that were preventing compilation, then Unity gave a popup to install IAP, which I did, including importing, and then I was able to uncomment out the lines that it was complaining about.
     
  12. vaishakh_r

    vaishakh_r

    Joined:
    Jun 22, 2018
    Posts:
    1
    What really worked for me after trying many things for couple of hours is the solution suggested by @mattbrandmm . Thanks Matt . It was a great relief to see it working.

    For those who would like to get logs from Unity on Android device is
    adb logcat -s Unity PackageManager dalvikvm DEBUG

    You need to have adb installed for this which usually comes with Android Studio or you can download it .
     
    Astirian and mattbrandmm like this.
  13. Tom-Atom

    Tom-Atom

    Joined:
    Jun 29, 2014
    Posts:
    128
    Solution by @mattbrandmm worked for me.

    In my case I added script for handling IAPs form another game before I enabled IAPs in Services. It looks, like it creates kind of deadlock: IAP service does not finish installation before you remove errors in code and errors are not removed before IAP service is imported. Commenting error lines of code out temporarilly allows Services to import IAPs.
     
    Astirian and mattbrandmm like this.
  14. Astirian

    Astirian

    Joined:
    Apr 28, 2018
    Posts:
    13
    Jesus, Mary and Joseph!! I wasted days on this. Whole Sunday evenings, gone. You've just about saved my sanity @mattbrandmm ... If I wasn't working for myself, I would have been fired over this. I still might fire myself, we'll see!

    Thank you!
     
  15. kmsjkh

    kmsjkh

    Joined:
    Jan 31, 2016
    Posts:
    10
    @SkyboardSoftware
    it works!!!! thank you!!!
     
  16. Skyboard_Studios

    Skyboard_Studios

    Joined:
    Jul 20, 2013
    Posts:
    51
    It is quite amazing on how much time one can spend on such activities!
    Latest Version is all working now.



    @mattbrandmm commenting out the lines of code that have the issue before updating would smooth-en out the process for sure. Great catch!
     
    Last edited: Dec 15, 2018
    mattbrandmm likes this.
  17. Janibasha

    Janibasha

    Joined:
    Mar 7, 2017
    Posts:
    6
    To fixed it, just go the folder 'UnityPurchasing' folder in 'Plugins' folder. Then double click on the package Unity IAP. Import all and the problem solved. If it does fix your problem just try Dong Nguyen solution.
     
  18. martin_unity660

    martin_unity660

    Joined:
    Feb 15, 2019
    Posts:
    22
    Hi,

    I run into the same error. I tried now all of the solutions here without any success. If I create a new project or load the SurvivalShooter_IAP_Demo it seems to work totally fine. But as soon as I add it to my existing project this error will show up. Any suggestions?
     
  19. GRE

    GRE

    Joined:
    Apr 19, 2013
    Posts:
    18
    thank you!
    ur solution works well
     
    CrandellWS likes this.
  20. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,174
  21. Jonsi

    Jonsi

    Joined:
    May 21, 2013
    Posts:
    4
    Thanks!This worked for me.
     
  22. shoridevel

    shoridevel

    Joined:
    Jan 28, 2015
    Posts:
    1
    Solve: You must import in this order.
    1. IAP On.
    1. IAP import.
    2. Your sourcecode import.
     
  23. austinborden

    austinborden

    Joined:
    Aug 5, 2016
    Posts:
    15
    In my case I was getting the error from a test class that has an asmdef. I had to add UnityEngine.Purchasing.dll and Stores.dll to the references and the error went away.

    assembly_reference.png
     
  24. jimbojimbo82

    jimbojimbo82

    Joined:
    May 22, 2019
    Posts:
    3
    Thank you this worked a treat!!!
     
  25. JeddJedd

    JeddJedd

    Joined:
    Jul 15, 2017
    Posts:
    1
    Skyboard you're a lifesaver. Importing manually fixed it. Thank you.
     
  26. ferranases

    ferranases

    Joined:
    Feb 27, 2017
    Posts:
    7
    That work for me.
    Commented the lanes that give me errors, then the project compile in Unity and show you to install things, and then come back to uncoment the code :)
     
unityunity