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

Can't build with IAP disabled

Discussion in 'Unity IAP' started by vincent-savysoda, Nov 27, 2019.

  1. vincent-savysoda

    vincent-savysoda

    Joined:
    Dec 19, 2016
    Posts:
    33
    Hi there, I'm trying to make a "Server Build" version of our project but was encountering errors with Unity Purchasing so I tried disabling IAP via Services instead. After fixing all compiler related errors, I tried to then make a build, but the editor is now giving me the following build error:
    ArgumentException: The Assembly UnityEngine.Purchasing is referenced by Stores ('Assets/Plugins/UnityPurchasing/Bin/Stores.dll'). But the dll is not allowed to be included or could not be found.

    Any ideas on how I can get through this problem?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You uninstalled IAP? That is the correct approach, you should not be receiving any purchasing errors. Can you provide the exact error, including the file name and line number?
     
  3. vincent-savysoda

    vincent-savysoda

    Joined:
    Dec 19, 2016
    Posts:
    33
    @JeffDUnity3D For more info I'm currently using Unity 2018.4.13f1 on IL2CPP

    Code (CSharp):
    1. ArgumentException: The Assembly UnityEngine.Purchasing is referenced by Stores ('Assets/Plugins/UnityPurchasing/Bin/Stores.dll'). But the dll is not allowed to be included or could not be found.
    2. UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1[T] alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2[TKey,TValue] cache, UnityEditor.BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:150)
    3. UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, UnityEditor.BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:190)
    4. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    5.  

    Also, in addition to the build errors, I'm now getting the following errors if i run the game in the editor:

    Code (CSharp):
    1. Unloading broken assembly Assets/Plugins/UnityPurchasing/Bin/Editor.dll, this assembly can cause crashes in the runtime
    2. Unloading broken assembly Assets/Plugins/UnityPurchasing/Bin/Stores.dll, this assembly can cause crashes in the runtime
    3.  
    4. ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
    5. System.Reflection.Assembly.GetExportedTypes () (at <e1319b7195c343e79b385cd3aa43f5dc>:0)
    6. BlendModes.ComponentExtension+<>c.<GetExtensionMap>b__36_1 (System.Reflection.Assembly a) (at Assets/BlendModes/Runtime/ComponentExtension.cs:256)
    7. System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () (at <fbb5ed17eb6e46c680000f8910ebb50c>:0)
    8. BlendModes.ComponentExtension.GetExtensionMap () (at Assets/BlendModes/Runtime/ComponentExtension.cs:257)
    9. BlendModes.ComponentExtension.PreloadExtensionMap () (at Assets/BlendModes/Runtime/ComponentExtension.cs:282)
    10.  
    11. ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
    12. System.Reflection.Assembly.GetTypes () (at <e1319b7195c343e79b385cd3aa43f5dc>:0)
    13. Facebook.Unity.CodelessIAPAutoLog.FindTypeInAssemblies (System.String typeName, System.String nameSpace) (at <f291c17795434dc28c3b2c582bb2d4c3>:0)
    14. Facebook.Unity.CodelessIAPAutoLog.FindObjectsOfTypeByName (System.String typeName, System.String nameSpace) (at <f291c17795434dc28c3b2c582bb2d4c3>:0)
    15. Facebook.Unity.CodelessIAPAutoLog.addListenerToIAPButtons (System.Object listenerObject) (at <f291c17795434dc28c3b2c582bb2d4c3>:0)
    16. Facebook.Unity.Editor.EditorFacebookGameObject.OnAwake () (at <f291c17795434dc28c3b2c582bb2d4c3>:0)
    17. Facebook.Unity.FacebookGameObject.Awake () (at <f291c17795434dc28c3b2c582bb2d4c3>:0)
    18. UnityEngine.GameObject:AddComponent()
    19. Facebook.Unity.ComponentFactory:GetComponent(IfNotExist)
    20. Facebook.Unity.Editor.EditorFacebookLoader:get_FBGameObject()
    21. Facebook.Unity.CompiledFacebookLoader:Start()
    22.  
     
    Last edited: Nov 28, 2019
  4. vincent-savysoda

    vincent-savysoda

    Joined:
    Dec 19, 2016
    Posts:
    33
    Just to be sure: All I'm supposed to need to do is to just disable the IAP settings in Services correct? Or do i also need to do something else? Like deleting the UnityPurchasing plugin folder etc etc
     
  5. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    626
    If you no longer use Unity IAP, I recommend that you delete all files related to the IAP plugin.
     
  6. vincent-savysoda

    vincent-savysoda

    Joined:
    Dec 19, 2016
    Posts:
    33
    I'm only doing this for the SERVER-ONLY build. Normally how we would have set it up is that we would have used a build script to toggle on/off certain settings depending on what type of build we want. But unfortunately in this case I was not able to identify a way to do disable IAP since marking the build with compiler definitions(e.g. !UNITY_PURCHASE) doesn't help as the native IAP scripts still triggers errors on run-time.

    Ideally we would prefer to have it so that we don't have to keep manually turning IAP on/off and deleting related files everytime we want to make this server-only build. It should have been triggered automatically using our build scripts.
     
  7. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    626
    If you disabled the IAP, you need to delete all files related to the IAP plugin to build successfully.

    Without disabled IAP, it should be OK to build with compiler definitions, it should not trigger the native IAP scripts errors. What compiler definition do you use? Did it come with Unity or did you create it yourself? What runtime errors would you encounter if you used a compiler definition without IAP disabled?
     
  8. vincent-savysoda

    vincent-savysoda

    Joined:
    Dec 19, 2016
    Posts:
    33

    Hmm i think there might be something that I've done wrong on the build script end. I will do some further testing and will get back to you if a further problem arises.
     
  9. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    626
    Thank you! Please let us know if you have any further questions or concerns.