Search Unity

Method not found: 'UnityEngine.VR.VRSettings and no API Update triggered

Discussion in 'Unity IAP' started by Good_Punk, Jul 19, 2018.

  1. Good_Punk

    Good_Punk

    Joined:
    Aug 6, 2014
    Posts:
    81
    Hello,

    I get the following error when I try to purchase an item:
    07-19 09:58:53.986: E/Unity(26951): MissingMethodException: Method not found: 'UnityEngine.VR.VRSettings.get_enabled'.

    From what I've read there should be an API update to fix this. But whatever I do I don't get to trigger that. I've actually formatted my harddrive, re-installed Windows and Unity completely and started on a new project and still got that issue.

    If I give the project to a colleague he gets prompted to update the API and afterwards everything works fine. Even though we use the same Unity version I can't get my editor to update the API. I've removed the whole IAP packager, folder, enabled and disabled purchasing. Re-downloaded and re-installed but to no avail.
     
    ROBYER1 likes this.
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. Good_Punk

    Good_Punk

    Joined:
    Aug 6, 2014
    Posts:
    81
    I've created a new project.
    Enabled IAP and clicked the Import Button.
    I've installed and ran the IAP updater.

    Now I have the IAP package "2.0.3" in the project but there wasn't any prompt to update the API.

    I'm using Unity 2018.2.0f2 but I had the same issue with older versions.

    I've downloaded the example project and got a message that it was created with Unity 2017xxx. After reimport no API Update dialog appeared but I got "Request couldn't be processed" in the services tab (which obviously makes sense as the project is not linked to my account)

    On a side-note: I don't get the "TypeLoad" error I've read in similar threads... only the Missing Method. Not sure if that's relevant though.

    On another side-note: When my colleague updated the API everything worked fine when I built the game until I've updated the IAP on my machine via the IAP-Updater which broke the purchase functionality again. To me it seems to be a problem with either my machine, Android SDK, Unity settings... but not related to the project itself.
     
  4. Good_Punk

    Good_Punk

    Joined:
    Aug 6, 2014
    Posts:
    81
    My colleague just updated the API on his machine. These files were changed:
    Summary of changes:
    .../Assets/Plugins/UnityPurchasing/Bin/Editor.dll | Bin 82944 -> 82432 bytes
    .../Assets/Plugins/UnityPurchasing/Bin/Stores.dll | Bin 143872 -> 142848 bytes
    {Repository Name}/Assets/Resources.meta | 4 +---
    .../Editor DLL/TextMeshPro-2017.3-Runtime.dll | Bin 321536 -> 314368 bytes
    .../ProjectSettings/PresetManager.asset | Bin 4104 -> 120 bytes
    .../ProjectSettings/UnityConnectSettings.asset | 2 +-
    6 files changed, 2 insertions(+), 4 deletions(-)
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @Good_Punk there is no IAP package 2.0.3, I believe you are referring to the Package Manager package version (they both are required for IAP to work). If you noticed in the sample project, there is an IAPManager.cs script outside the Assets/Plugins folder. During the IAP upgrade, this file may throw compile errors, and the update might not succeed. The lesson is to remove all external references to IAP during the import/upgrade process, we are working to improve this. The sample project is a good place to start, and yes, obviously you need to generate a new ProjectID linked to your organization. The VR error is ALWAYS a sign that the API Update did not occur (don't confuse the term API with IAP)
     
  6. Good_Punk

    Good_Punk

    Joined:
    Aug 6, 2014
    Posts:
    81
    Yes I'm aware of that... as I said the API update on my colleague's machine fixes everything. It's just that I can't get it to trigger in my Editor. There are no compile errors and we both use the same Unity version. He opens the project and gets a popup for the API Update. When I open the very same project nothing happens.

    When he commits the changes after the API update I can build the project just fine and purchasing works in the App. As soon as a new IAP version is released and I run the updater the API breaks again and I'm back to the VR-Error.
     
  7. inejwstine

    inejwstine

    Joined:
    Sep 22, 2012
    Posts:
    4
  8. avindak

    avindak

    Joined:
    Mar 5, 2019
    Posts:
    11
    Hi,
    I am still getting this issue.
    I removed all payments related code, reimported as in the tutorial and its still the same.
    Can you provide a hack for this ?
    To be honest its not reasonable. There should be a simpler way to make it work without changing all of your code.
    Please assist.
     
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    What version of Unity are you using? Are you seeing the VR error in the logs, and did not get the Update API prompt?
     
  10. avindak

    avindak

    Joined:
    Mar 5, 2019
    Posts:
    11
    Just updated to the latest version of Unity and its still happening. (2019.1.3f1)
    Its a Windows 10 machine
    Now when I try to reimport I get the installer dialog, run the Unity IAP installer and then Unity crashes if there is something to import or has nothing to import.
     
    Last edited: May 20, 2019
  11. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    There is a known issue with Unity 2019 and the API Updater. You need to install it to a location without a space in it, like C:\Unity. Then the IAP importer should work, and you should get prompted for the API update.
     
  12. avindak

    avindak

    Joined:
    Mar 5, 2019
    Posts:
    11
    Hi,
    It didnt work :(
    Any other ideas ?
     
  13. unity_l3Ac7R_V3zAEkQ

    unity_l3Ac7R_V3zAEkQ

    Joined:
    Jul 27, 2018
    Posts:
    9
    Hi,
    i am also having same issue. i have unity 2018.3.11f1. if there are any idea please let me known
     
  14. MasoInar

    MasoInar

    Joined:
    Feb 20, 2014
    Posts:
    126
    Started having same problem (Using Unity 2019.1.3f1). Reimporting Unity IAP not helping..
     
  15. LastChaos

    LastChaos

    Joined:
    Dec 9, 2013
    Posts:
    39
    Same problem here. 2019.1.3f1
     
  16. avindak

    avindak

    Joined:
    Mar 5, 2019
    Posts:
    11
    I updated to 2019.1.4f1
    And now I get:
    Reload Assembly called from managed code directly. This will cause a crash. You should never refresh assets in synchronous mode or enter playmode synchronously from script code.
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

    [COLOR=rgba(0, 0, 0, 0.87)][/COLOR]
     
  17. avindak

    avindak

    Joined:
    Mar 5, 2019
    Posts:
    11
    Its still a bug on Unity editor (BTW I also tried it on Mac and it did not work)

    I finally managed to work around this.
    Do the following (I found it here https://answers.unity.com/questions/1424736/unity-iap-issue-android.html)

    1. Find UnityPurchasing - Bin - Android - GooglePlay.aar

    2. Change GooglePlay.zip

    3. UnCompress

    4. AndroidManifest.xml Open

    5. delete VRPurchaseActivity

    6. delete GooglePlay.zip

    7. Compress GooglePlay Folder

    8. Rename GooglePlay.aar
     
  18. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Extra steps should not be necessary (except no space in install path for Unity 2019). Ensure that you have NO compiler messages in your project prior to IAP import. If you remove the previous version before upgrading, your project MUST still compile without errors, prior to importing again. You would need to remove all references to Purchasing. Also, make sure you have the Purchasing package installed first, in Package Manager. As a test, please import IAP (only) into a brand new/empty project.
     
  19. TortoRacoon

    TortoRacoon

    Joined:
    Apr 17, 2019
    Posts:
    61

    I'm getting the same error on the device but it gets the prices right, it just get the error when trying to purchase anything, it shouldn't be calling the VR methods as I am not using such thing for a single 2D shooter. On the editor seems to be working just fine.

    If these instructions actually help, I wanna know, where do you get UnityPurchasing - Bin - Android - GooglePlay.aar from. Sorry, this is all new to me
     
  20. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    As discussed, you need to confirm to update the Unity API when prompted during the install or you will get the VR error on the device.