Search Unity

[Solved] Why every store base implementation is included in Stores.dll?

Discussion in 'Unity IAP' started by MHM90, Oct 21, 2017.

Thread Status:
Not open for further replies.
  1. MHM90

    MHM90

    Joined:
    Oct 21, 2017
    Posts:
    5
    Hi,

    I was wondering if someone wants to build its game only for a platform (for example iOS) why should he include all the dlls for other platforms (Tizen, WinRT, Android, etc) from package import!
    When I removed extra platforms store's dll, I ran into this:
    ArgumentException: The Assembly winrt is referenced by Stores (... Stores.dll)
    I was looking in "Stores.dll" and I found out that every platform has a base implementation on it in addition to separate dlls for each specific one. I think it is easily possible to make every platform module register itself to core logic in "Stores.dll" instead of adding each module base in "Stores.dll". User can activate his target platform with a simple #if directive on initialization process (for example create specific platform store handler impl from platform specific dll and register it using ConfigurationBuilder). I mean why Stores.dll should depend on other platform dlls. It must provide the required interfaces and the implementation should be in other store dll files.
    Also, I wanted to know if there is anyway to remove all the plugin in specific app build without deleting the whole plugin and just by not referencing to any of these dlls in my scripts using some #if directive?

    Thanks
     
    Last edited: Oct 23, 2017
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The other platform dlls that Stores.dll references are only stub dlls, and very small with no actual code. This is to keep the number of changes needed at build time to a minimum.
     
  3. MHM90

    MHM90

    Joined:
    Oct 21, 2017
    Posts:
    5
    OK. I don't know your build workflow, but, is it possible to include this stubs in Stores.dll itself?
    And, what about my second question:
    It is just when I remove every reference to UnityPurchasing Api in my scripts and try to build a version without in-app purchase, it includes the full libs in the build.
     
  4. maxthecat

    maxthecat

    Joined:
    May 26, 2014
    Posts:
    29
    We have a similar issue with needing to remove IAP for some builds and keep for others.

    The solution we use is based on the following link

    https://stackoverflow.com/questions/41416553/where-is-the-unity-iap-package-located

    Look for the code in deleteAndDisableAIP()

    We also delete the UnityChannel folder

    Code (CSharp):
    1.            
    2. FileUtil.DeleteFileOrDirectory( "Assets/Plugins/UnityPurchasing" );
    3. FileUtil.DeleteFileOrDirectory( "Assets/Plugins/UnityChannel" );
    4.  
    5. // disable Unity IAP...
    6. UnityEditor.Purchasing.PurchasingSettings.enabled = false;
    7.  
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @maxthecat I believe a safer solution rather than deleting files in code would be a proper #if directive. I'll check with the IAP team here. I'm not sure how line 6 would execute reliably if you had already deleted the Plugins directory, unless the Purchasing object was already in memory.
     
  6. MHM90

    MHM90

    Joined:
    Oct 21, 2017
    Posts:
    5
    What do you mean by #if directive? How could I make unity to avoid adding purchasing libs at build time by #if directive? I've already avoid referencing unity purchasing API in my scripts using #if directive if you mean it.
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, I meant I will check with the IAP team here to see if there is a way to properly use an #if directive or use another approach. Sorry for the confusion.
     
  8. maxthecat

    maxthecat

    Joined:
    May 26, 2014
    Posts:
    29
    Good point. I should move it to before deleting the folders.

    I think line 6 is used to turn the Unity services off, and the code seems to be in UnityEditor.dll

    Lines 2 & 3 are to ensure we don't include unnecessary dll files. Using just a #define wasn't satisfactory.
     
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you elaborate regarding the need to not include the dll files? They are quite small.
     
  10. maxthecat

    maxthecat

    Joined:
    May 26, 2014
    Posts:
    29
    Agreed, but anything to help make the final build size smaller helps.
     
  11. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @maxthecat

    This was brought up with the IAP team and having a more modular system is in their backlog, but I can't say for sure when it would be available.

    If you have any particular use case where this would be necessary (aside from reducing the build size and removing unused code, which are important reasons in and of themselves), it would be helpful for the team to understand your need.
     
  12. MHM90

    MHM90

    Joined:
    Oct 21, 2017
    Posts:
    5
    We work with specific publisher which has this rule not to include any in app purchase system in your code. They know we are not using it in any place of our game, but the code is included in the build.
     
  13. maxthecat

    maxthecat

    Joined:
    May 26, 2014
    Posts:
    29
    We have the same rule.
     
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Which publisher is enforcing this rule? I checked with the IAP team, and the consensus is that such a change would be too risky unless we have strong evidence to support this need. In the meantime, you could consider separate projects or separate builds.
     
Thread Status:
Not open for further replies.