Unity IAP plugin is installed, but Unity IAP is disabled - error

hi,

I’m constantly getting errors with Unity IAP when I’m working offline. It’s slightly random, but definitely very frequent.

The gist is while I’m online and I can see the services on the Services tab then everything is fine. If I go offline though,a few minutes later, Visual Studio asks to Reload the project as there has been modifications. Browsing back to Unity I see loads of errors on the console relating to Unity IAP.
Besides the one on the title, it also says “Could not load file or assembly UnityEngine.Purchasing, Version=0.0.0.0.”

I can “fix” the problem by going online again, waiting for the services to refresh then go back to visual studio and reload the solution again, but this is happening way too often now to the point that it’s slowing down my development.

I’m on version 5.5.0f3 using Visual Studio 2015 Enterprise Edition Update 2.


Any ideas would be very much appreciated.

thanks a bunch!

This how I fix this error … Double click on red alert will open “PurchasingCheck.cs” codes :

#if !UNITY_PURCHASING
#error "Unity IAP plugin is installed, but Unity IAP is not enabled. Please enable Unity IAP in the Services window."
#endif
  1. cut this code + save => unity
    services tab will reload and work
  2. past the code again + save .

i think this is another bug still exist on last version 5.5.2f1

EDIT 2

since this is a known bug i just trying to set how i skip it

  1. cut this code + save => unity
  2. Assets reimport All
  3. click services icone
  4. past the code again + save .

@nicholasr

Hi Nicholas,

I experienced the same problem (working with version 5.5.2 f1). But bouemama’s workaround did not work for me. I had to remove the whole folder UnityPurchasing from the Assets/Plugins folder. After having done that services window in the editor loaded again (which was very important as we use Colleborate). After loading IAP service was toggled off.

I refrain from integrating the IAP plugin again. The problem occurred totally out of the blue. We had integrated the IAP plugin about two weeks ago and until today there were no problems.

What do you recommend? Update to 5.6? Thanks

I have the same problem … Someone can fix that ? Im trying to relog, exit Unity, relog again and IAP not start.

TypeLoadException: Could not load type 'LODLightmapScale' from assembly 'UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

FileNotFoundException: Could not load file or assembly 'UnityEngine.Purchasing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
System.Reflection.MonoMethodInfo.GetMethodInfo (IntPtr handle) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:59)
System.Reflection.MonoMethod.GetPseudoCustomAttributes () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:293)
System.MonoCustomAttrs.GetPseudoCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/MonoCustomAttrs.cs:78)
System.MonoCustomAttrs.IsDefined (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/MonoCustomAttrs.cs:301)
System.Reflection.MonoMethod.IsDefined (System.Type attributeType, Boolean inherit) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:274)
System.Attribute.IsDefined (System.Reflection.MemberInfo element, System.Type attributeType, Boolean inherit) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Attribute.cs:326)
System.Attribute.IsDefined (System.Reflection.MemberInfo element, System.Type attributeType) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Attribute.cs:299)
UnityEditor.EditorAssemblies.ProcessStaticMethodAttributes (System.Type type) (at C:/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs:95)
UnityEditor.EditorAssemblies.ProcessInitializeOnLoadAttributes () (at C:/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs:158)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes()

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

The Unity IAP plugin is installed, but Unity IAP is disabled. Please enable Unity IAP in the Services window.

@bouemama @guimak @MaverickPL I apologize for the frustration. Thank you for sharing the issues and the workaround.

We’re planning on addressing the online/offline “sensitivity” generally, for all Unity Services in an upcoming Unity version. We recognize its faults. The work is ongoing so no release date is available yet. A workaround that may also work is to manually copy the UnityEngine.Purchasing.dll into your project (from /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/UnityPurchasing/ folder), bypassing the automatic copying currently performed by the Services window.

Also we’re hopefully helping prevent perma-broken projects by changing the PurchasingCheck code to be a ‘warning’ in Unity IAP 1.10.1, shipping hopefully this week.

God I hate Unity, I have the same problem, services just crap out for no reason, now I cannot compile, cannot open Services window, NOTHING!

Happens to me, too. Pretty annoying to have a “magic one button integration”, that doesn’t work. It’d be nice if they’d look at fixes instead of doing nothing. Try explicitly defining by including

#define UNITY_PURCHASING

at the top of a file.

See my workaround here error CS1029: #error: 'UnityFx.Purchasing requires Unity IAP service to be enabled.' - Questions & Answers - Unity Discussions

I am also sick to death of Unity. Really crap. And getting worse. Huge regrets about going with this crap tool.