Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question NullReferenceException Caused by UnityPurchasingEditor on all new projects

Discussion in 'Getting Started' started by paultoth, Aug 30, 2022.

  1. paultoth

    paultoth

    Joined:
    Mar 30, 2021
    Posts:
    15
    I am very new to working in Unity (2021.3.8f1 Personal) and every project I have made throws this error whenever I open it initially as well as whenever I run the game view. It has not prevented me from designing and building my mini game, but I cannot build the project for windows as I get:
    Cannot build player while editor is importing assets or compiling scripts


    As far as I know, I am not using any purchasing functions and this is a simple game made by following Brackey's How to make a game tutorial. Could anybody help me figure out what is causing this so I can build my first game? Please let me know of any other information I should provide!

    Error:
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.Purchasing.UnityPurchasingEditor.ConfigureProject (UnityEngine.Purchasing.AppStore target) (at Library/PackageCache/com.unity.purchasing@4.3.0/Editor/UnityPurchasingEditor.cs:258)
    3. UnityEditor.Purchasing.UnityPurchasingEditor.TryTargetAndroidStore (UnityEngine.Purchasing.AppStore target) (at Library/PackageCache/com.unity.purchasing@4.3.0/Editor/UnityPurchasingEditor.cs:219)
    4. UnityEditor.Purchasing.UnityPurchasingEditor.TargetAndroidStore (UnityEngine.Purchasing.AppStore target) (at Library/PackageCache/com.unity.purchasing@4.3.0/Editor/UnityPurchasingEditor.cs:200)
    5. UnityEditor.Purchasing.UnityPurchasingEditor.CreateDefaultBillingModeFile () (at Library/PackageCache/com.unity.purchasing@4.3.0/Editor/UnityPurchasingEditor.cs:160)
    6. UnityEditor.Purchasing.UnityPurchasingEditor+<>c.<.cctor>b__24_0 () (at Library/PackageCache/com.unity.purchasing@4.3.0/Editor/UnityPurchasingEditor.cs:153)
    7. UnityEditor.EditorApplication.Internal_CallDelayFunctions () (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    8.  
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    I support Unity IAP. Can you provide exact steps to reproduce with a new project? From the logs, it appears that you have In App Purchasing version 4.3.0 installed in Package Manager, can you confirm? This package is not installed by default. It looks like your project is targeting Android as the IAP store (under the Services menu in the Editor) but building to Standalone Windows.
     
    paultoth likes this.
  3. paultoth

    paultoth

    Joined:
    Mar 30, 2021
    Posts:
    15
    1. As per the below image In App Purchasing is version 4.3.0: upload_2022-8-30_11-32-21.png
    2. "It looks like your project is targeting Android as the IAP store (under the Services menu in the Editor) but building to Standalone Windows."

      I am in fact trying to build for standalone windows. The below image shows what I see in the Services, Services/Ads, and Service/In-App Purchasing sections in Project settings (appears identical):
      upload_2022-8-30_11-35-44.png
    I hope this provides the information you are looking for!
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    @paultoth Sorry no, I meant under the Services menu in the Unity Editor, just to the right of the Component menu. But if you are not using IAP, simply remove it.
     
    paultoth likes this.
  5. paultoth

    paultoth

    Joined:
    Mar 30, 2021
    Posts:
    15
    @JeffDUnity3D Ah, well my bad!

    But I deleted the IAP package and that got rid of the error in this thread!!

    It still isn't building because of 471 other errors lol, but this is progress!!

    Thank you very much for the insightful and rapid assistance!!!
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Typically what I recommend is to start with a new/empty project and ensure that builds. Then go from there.
     
    paultoth likes this.
  7. paultoth

    paultoth

    Joined:
    Mar 30, 2021
    Posts:
    15
    Not sure what caused the errors initially, but that cleaned everything right up!

    Thank you for your help!