Our team has migrated to Unity 5.5.2f1. Some of our developers are noticing that the Unity Editor will start throwing the following error related to IAP:
#error: ‘“Unity IAP plugin is installed, but Unity IAP is not enabled. Please enable Unity IAP in the Services window.”’
To fix this issue the solution seems to be to switch IAP off and then back on again. When we check version control to see what performing this action does, all we see is a UnityConnectSettings.asset file but there are no changes to the file in SourceTree, we can even discard this file and the editor continues to work properly.
Not a major problem but it’s getting annoying as this happens multiple times a day during the course of development. Any ideas what might be happening here?
We’ve had users report this issue when one of their team members does not have IAP / Analytics enabled. If they don’t have it enabled, they might be updating the ProjectSettings or UnityConnectSettings, which would then be saved in your version control.
If you could, please confirm that everyone on the team has Analytics and IAP enabled. You should also confirm that every team member is added to your Organization and Project in the developer dashboard:
If that doesn’t resolve the issue, let me know and I’ll talk to the team that manages the Services window and see what the issue might be.
As I mentioned above, every time this occurs, the user that experiences the problem must switch the IAP toggle off / then back on. This causes a UnityConnectSettings.asset file appear in the user’s uncommitted changes in SourceTree, but when we inspect that file for differences there are no changes, yet it fixes the issue? Super weird. I just want to be clear that there is never a case where one of our users has IAP turned off. It seems that something else is going on here.
I just spoke with our engineering team. They are aware of this bug and actively working to get it fixed. I understand it is frustrating to have to have these errors hinder your development process. (We are also going to make those messages Warnings instead of Errors, which should make them a bit less annoying in the future.)
Thank you for your patience while we resolve this issue.
we am having this issue as well, and unity services tab is missing, its not in the menu bar as well. I have no way to toggle it. Collab is showing a blank window, i have a full day of bug fix in it…
I am using 5.6.1f1 and even though I get the message I still get a bunch of errors after unchecking IAP from my projects.
Assets/Plugins/UnityPurchasing/script/IAPDemo.cs(26,39): error CS0246: The type or namespace name `IStoreListener’ could not be found. Are you missing an assembly reference?
and 10 more like this.
So I went ahead and removed IAPDemo.cs and I am still getting errors:
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 /Users/builduser/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs:101)
UnityEditor.EditorAssemblies.ProcessInitializeOnLoadAttributes () (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs:164)
UnityEditor.EditorAssemblies:processInitializeOnLoadAttributes()
Unloading broken assembly Assets/Plugins/UnityPurchasing/Bin/Editor.dll, this assembly can cause crashes in the runtime
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.MonoMethodInfo.GetAttributes (IntPtr handle) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:75)
System.Reflection.MonoMethod.get_Attributes () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:245)
System.Reflection.MethodBase.get_IsSpecialName () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:184)
UnityEditor.Build.BuildPipelineInterfaces.InitializeBuildCallbacks (Boolean findBuildProcessors, Boolean findSceneProcessors) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:149)
The Unity IAP plugin is installed, but Unity IAP is disabled. Please enable Unity IAP in the Services window.
UnityEditor.EditorApplication:Internal_PlaymodeStateChanged()
The Unity IAP plugin is installed, but Unity IAP is disabled. Please enable Unity IAP in the Services window.
UnityEditor.EditorApplication:Internal_CallDelayFunctions()
The Unity IAP plugin is installed, but Unity IAP is disabled. Please enable Unity IAP in the Services window.
UnityEditor.Toolbar:OnGUI()
The Unity IAP plugin is installed, but Unity IAP is disabled. Please enable Unity IAP in the Services window.
UnityEditor.EditorApplication:Internal_PlaymodeStateChanged()
What patience?!?! I am frustrated as hell. And I need to work with this. I have no choice. I am forced.
It is a nightmare. No only this but the whole UWP platform.
I want to give a bit of context for why this is happening and what we are working to fix. Here’s how things should work:
You have a project with no services enabled yet. The service-specific extension in the engine is not loaded. (i.e. you can’t use UnityEngine.Purchasing if IAP is not enabled.)
You enable a service (like Unity IAP) and that extension is loaded in the engine.
Now you can use any methods, interfaces, etc. in that extension.
If you disable Unity IAP, then those methods are no longer defined, since that extension isn’t loaded. So you get errors such as “The type or namespace name `IStoreListener’ could not be found.”
That is the expected workflow and it would be fine. However, there seems to be cases where services are disabled when they shouldn’t be. That is the underlying issue that we are working to fix. There is a fix in QA right now that we hope to resolve part of the problem. (We have found that timeouts are one case where services are getting disabled.)
We made a change to the Services window in early March that resolved the problem of users overwriting other’s settings. Currently, the Service window will respect the local settings over the settings in the server.
To help troubleshoot any remaining issues, I would suggest a couple of things:
In Editor Settings (Edit → Project Settings → Editor) change Asset Serialization mode to “Force Text” (This will allow you to view the contents of the UnityConnectSettings.asset)
Make sure to save your project whenever you make a change to the Services window. (Changes are also saved when you close Unity normally.)
If anyone else has this issue (the IAP extension getting disabled even when the Service is enabled), please send a support ticket with the following information:
Project ID
UnityConnectSettings.asset (in Text Mode)
The context of the error (did it happen when you started Unity, when you left it open for hours, while you were actively using the Editor, etc.)
I apologize for not understanding your specific use case earlier. If you want to have a project that will have some builds with Purchasing enabled and some builds without Purchasing enabled, then you will need to do a couple of things:
Remove IAPDemo.cs
Remove Demo/DemoInventory.cs
Use preprocessor directives to basically hide all the purchasing code from the builds with Purchasing disabled.
#if UNITY_PURCHASING
using UnityEngine.Purchasing;
// All IAP code can go here
// If IAP is enabled, it will work
// If IAP is disabled, none of this code will run
#endif