Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

can't compile project with custom package

Discussion in 'Unity IAP' started by ShayKrainer, Apr 16, 2019.

  1. ShayKrainer

    ShayKrainer

    Joined:
    Feb 19, 2019
    Posts:
    16
    I'm using Unity IAP, I've imported all the unitypackages files that come with it (IAP, Channel and UDP) and I can't compile the project. I'm using Unity 2018.3.12f1 and latest versions of Package Manager and Unity IAP.
    I'm in a midst of moving our code base to custom packages so I have asmdef files all over the place.

    I get these errors:

    Assets\Plugins\UDP\Editor\Analytics\EditorAnalytcisApi.cs(4,23): error CS0234: The type or namespace name 'Common' does not exist in the namespace 'UnityEngine.UDP' (are you missing an assembly reference?)

    Assets\Plugins\UDP\Editor\AppStoreSettingsEditor.cs(15,26): error CS0246: The type or namespace name 'AppStoreSettings' could not be found (are you missing a using directive or an assembly reference?)



    I have no idea why this "using UnityEngine.UDP.Common;" is nowhere to be found while "UnityEngine.UDP" namespace is totally there in the EditorAnalytcisApi.cs script.
    And AppStoreSettings apparently found at Assets/Plugins/UnityChannel/XiaomiSupport/AppStoreSettings.cs .

    I've put asmdefs at all the relevant places yet they do know refer to each other correctly. What am I missing? Is there a workaround?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,794
    We would need exact steps to reproduce, and sounds like it might be difficult with "files all over the place". We have not heard of this error previously. I might suggest you try with a new/empty project to compare. This may help https://forum.unity.com/threads/sample-iap-project.529555/ Another thing to try (make a backup first) is to select Reset Packages to Default under the Help menu.
     
  3. ShayKrainer

    ShayKrainer

    Joined:
    Feb 19, 2019
    Posts:
    16
    Sorry, already gave up. But if I remember correctly I know where the problem was particularly with UDP. I put asmdef file since I've tried to transform our project to rely on these and on packages (and our custom packages) from the Package Manager.

    What I didn't do was in the asmdef file refer it to UDP.dll that sat right next to it. For some reason, I thought that asmdef auto-refer to dlls that reside at their folder or subfolder. This is really not the case. Also having the name space UnityEngine.XXX when XXX is not part of the core UnityEngine namespace but an external extension of it doesn't make it easier to find (I understood it when I couldn't find it in the scripts' references or in the manual at this site).

    So here's an idea to improve it - 1. namespace like UnityEditor.Callbacks and stuff that look like part of the main namespace should be more clear that they're not part of it.
    2. asmdef files should, in my honest opinion, auto-refer (or at least with a click of a button) to any and all dll files in their folder and sub-folders.
     
  4. mrm83

    mrm83

    Joined:
    Nov 29, 2014
    Posts:
    228
    Getting the same error.
    Updated from services -> iap and this error blows up.

    Unity 2018.3.12f1.

    Revert the changes and the error is still showing up.
     
  5. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,794
    Sorry I don't quite follow. You "revert the changes" and use your backed up project that you created from before the upgrade, and the error is still there? Which implies nothing changed at this point. What store are you targeting from the IAP menu? Can you provide steps to reproduce with the Sample IAP project here on the forum?
     
  6. mrm83

    mrm83

    Joined:
    Nov 29, 2014
    Posts:
    228
    Ignore my last message regarding reverting the change. The newly added files weren't deleted. Deleting those files fixed it.

    Also, I've successfully updated the library without errors but IAP no longer works on Android, still works fine on iOS.
    No errors observed on client, but IAP does nothing.

    No sample project, changes were made to our production code.
     
  7. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,794
    Please provide the results of your debugging on Android. I suspect what the issue is, the device logs will tell. And it's generally a good idea to test on a separate test project first before applying a new technology to an existing/working app. Your live game should never be "broken", better to break a test app first! https://forum.unity.com/threads/how-to-capturing-device-logs-on-android.528680/
     
  8. mrm83

    mrm83

    Joined:
    Nov 29, 2014
    Posts:
    228
    Here is the error:
    09-18 17:10:49.842 24388 24461 I Unity : BuyProductID: FAIL. Exception during purchase. System.MissingMethodException: bool UnityEngine.VR.VRSettings.get_enabled()
    09-18 17:10:49.842 24388 24461 I Unity : at UnityEngine.Purchasing.JSONStore.Purchase (UnityEngine.Purchasing.ProductDefinition product, System.String developerPayload) [0x00129] in <50891d6b80fb4d02b58505065f8b0238>:0
    09-18 17:10:49.842 24388 24461 I Unity : at UnityEngine.Purchasing.PurchasingManager.InitiatePurchase (UnityEngine.Purchasing.Product product, System.String developerPayload) [0x0003c] in <c1581d1a48d844e184f446d8ddca2724>:0
    09-18 17:10:49.842 24388 24461 I Unity : at PurchaseController.BuyProductID (System.String productId) [0x0005f] in <f509f58e526c4d0c9b428759eae7111e>:0 bool UnityEngine.VR.VRSettings.get_enabled()
     
  9. mrm83

    mrm83

    Joined:
    Nov 29, 2014
    Posts:
    228
    I remember that error.

    Updated API and it is fixed now.