Search Unity

Exception: Error: called non-existent method System.Boolean UnityEngine.VR.VRSettings::get_enabled(

Discussion in 'Unity IAP' started by Antony-Blackett, Feb 22, 2018.

  1. quimbytron

    quimbytron

    Joined:
    Mar 4, 2019
    Posts:
    1
    joshua1zn's solution helped me as well:

    Created an empty project in latest 2018 version Unity where I added the IAP package and enabled the IAP service, then copied over the files from the 3 plugin directories to the 2019 project.

    The only difference I can see from source control is that Plugins\UnityPurchasing\Bin\Editor.dll and Plugins\UnityPurchasing\Bin\Stores.dll have now been added as new files (I also see a few guids changed in metafiles, but i guess that was due to something else).

    The "Update API, did you make a backup first" popup didn't show for me either even though I had no console errors prior to importing the IAP package. I also removed and re-added the IAP package and removed the plugin files prior to importing them again.

    Please investigate this, it was yet another very annoying and confusing bug in Unity. It doesn't make sense to me why VR is referenced here when there's no VR package or code at all in the project.
     
  2. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    Hi @quimbytron

    I am sorry for the troubles. Do you have a repro project that you could share privately so I can investigate?

    Also, have you tried to delete Library folder while trying to solve the issue?

    Best

    Adriano
     
  3. Mirgan

    Mirgan

    Joined:
    Feb 2, 2016
    Posts:
    24
    I tried to delete Library folder, but it did not help.
    joshua1zn thx for solution, you save my day!
     
  4. Mintonne

    Mintonne

    Joined:
    Aug 7, 2015
    Posts:
    281
  5. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    Thanks for the info. That rules out one of my hypotheses. Back to square zero.

    @Mintonne
    No (that's why I am asking for a repro project); but I have not dived into it.

    Adriano
     
  6. Mintonne

    Mintonne

    Joined:
    Aug 7, 2015
    Posts:
    281
    @AdrianoVerona_Unity, here you go - https://github.com/Mintonne/Unity-IAP-Bug

    I have also attached a unitypackage that you can easily use.

    Bug Description (v2019.1.0f2)

    The API Update Required dialog does not show up at all in Unity 2019.1.0. I have tried it on 2 different PCs running Windows 10 1809 with clean installs of Unity Hub + v2019.1.0f2.

    Annotation 2019-05-07 134553.jpg

    These two files seem to be the issue.
    • Assembly: 'Assets/Plugins/UnityPurchasing/Bin/Stores.dll' uses obsolete Unity API (UnityUpgradable)
    • Assembly: 'Assets/Plugins/UnityPurchasing/Bin/Editor.dll' uses obsolete Unity API (UnityUpgradable)
    To reproduce the bug, you will need to setup IAP in the Editor and on Google Play then build the project and test it on an actual device (or emulator).

    Annotation 2019-05-07 093727.jpg

    The error only shows up when you attempt to make a purchase. IAP initialization completes successfully.

    If you need the APK file, let me know and I will send it to you privately.
     

    Attached Files:

    Last edited: May 14, 2019
  7. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
  8. stevensrmiller

    stevensrmiller

    Joined:
    Oct 20, 2017
    Posts:
    180
    This is exactly the same behavior that I am experiencing.
     
  9. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    126
    I have the same issue in Unity 2019.1.1f1. When I want to make a purchase in my Android device, it throws an error saying that a non-existent VR method is being called. My game is not VR. I have tried to debug for two days, only to find that it is a bug in Unity 2019.
     
  10. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    @stevensrmiller
    @better_walk_away

    Does your Unity installation contains spaces in the path?

    We've found one issue that would prevent AssemblyUpdater to run in this scenario and we would not detect the failure.

    If this is the case can you install to a folder without spaces and try again?

    I'll fix this issue now and make sure it gets back ported to 2019.1

    Adriano
     
    Last edited: May 8, 2019
  11. stevensrmiller

    stevensrmiller

    Joined:
    Oct 20, 2017
    Posts:
    180
    joshua1zn's solution got me past this bug. To reiterate:
    1. Delete the UDP, UnityChannel, and UnityPurchasing folders in Assets / Plugins in your Unity 2019 project.
    2. Create a new Unity project using version 2018.3
    3. Activate IAP in the Services tab and click the import buttton.
    4. After importing, you will be prompted to run the API Updater. Go ahead and run it.
    5. After the API Updater is done, copy the UDP, UnityChannel, and UnityPurchasing folders in Assets / Plugins from your Unity 2018.3 project to Assets / Plugins in your Unity 2019 project.
    6. Recompile your code that calls IAP functions.
    This made the call to the non-existent VR method go away for me.

    I wonder if one could import the 2019 IAP assets, copy that to a new 2018 project, and maybe run the API Updater there, then copy the updated IAP assets back. Since the problem has gone away with the above steps, I haven't tried it, but it might be a better fix (because it uses 2019's IAP assets, though these might be the same for each version).

    My problem now is that my APK generates a "The item you requested is not available for purchase" error on my tablet. Interestingly, the arguments passed to OnPurchaseFailed confirm that my APK communicated with the Google Play store, as the store passes back the full description of the item. If anyone can help with that, I'd be grateful.
     
  12. stevensrmiller

    stevensrmiller

    Joined:
    Oct 20, 2017
    Posts:
    180
    Do you mean like the space in "Program Files" in my path to the directory where Unity is installed? Or do you mean on the path to my project? (In both cases, the answer is "yes.")
     
  13. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,467
    You have a separate issue, not related to this thread. Please open a new thread.
     
  14. stevensrmiller

    stevensrmiller

    Joined:
    Oct 20, 2017
    Posts:
    180
    Wait, you specifically addressed this question to me. I don't understand you. Why did you ask me about spaces?

    And my issue is exactly related to this thread. I am getting the exact same error exception as the title of this thread.
     
  15. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    126
    Hi,
    The path to my project folder is "C:\Users\user\Documents\NT60PaidGame", it doesn't contain spaces. The path to Unity.exe is "C:\Program Files\Unity\Hub\Editor\2019.1.1f1\Editor\Unity.exe", there is a space between "Program Files", but every Windows user has the same folder name, so I don't think this is what causes the issue.
     
  16. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    126
    joshua1zn's solution doesn't work for me, the "Update API, did you make a backup first" popup did show up after replacing the IAP folders with the IAP folders from 2018. But I still get the "called non-existent method System.Boolean UnityEngine.VR.VRSettings::get_enabled()" error when I click the IAP button in my game.
     
  17. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    126
    Hi guys,
    After downgrading to Unity 2018.3.14f1, and then built my game again, I can now make a purchase successfully. I think there is something wrong with Unity 2019.1. VRSettings has been changed to XRSettings, but I guess Unity IAP in 2019 is still referencing the old VRSettings, which causes the error.
     
  18. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    @better_walk_away

    Can you try to install Unity to folder without spaces?

    I was able to reproduce AssemblyUpdater.exe not running when Unity is installed in a path with spaces; I am surprised this issue did not showed up earlier but I do think this is the cause of the failure

    I think that referencing VRSettings is intentional, basically a way to avoid having multiple releases, of for each version of Unity.

    Adriano
     
    Last edited: May 9, 2019
  19. stevensrmiller

    stevensrmiller

    Joined:
    Oct 20, 2017
    Posts:
    180
    It sounds like you replaced the IAP folders before running API Updater. If so, try it in the other order:
    1. In the Unity 2018 editor, import IAP and run API Updater.
    2. Copy the IAP folders from Unity 2018 to Unity 2019.
     
  20. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    @stevensrmiller

    the former. Can you try to install Unity to a path without spaces and try to reproduce the issue?

    Regarding:

    I guess @JeffDUnity3D was referring to:

    Best

    Adriano
     
  21. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,467
    No, you specifically said you resolved the issue "This made the call to the non-existent VR method go away for me. My problem now is that my APK generates a "The item you requested is not available for purchase" error on my tablet." This is a separate issue.
     
  22. stevensrmiller

    stevensrmiller

    Joined:
    Oct 20, 2017
    Posts:
    180
    Then why did he put "@stevensrmiller" in his post asking if I had spaces in my path?

    I would hardly call the work-around people are using for this the same as "resolved the issue." I assumed (and, apparently correctly) that Adriano's question about spaces was directed at the VR-related problem. (And I am trying that fresh install to a path without spaces now, but it is proceeding slowly.)
     
  23. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231

    You understood it correctly :) (my question at least)

    And thanks for trying it out.

    Adriano
     
  24. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,467
    Agreed, but you still have a separate issue, which I only wanted to point out. It's not related to the VR issue.
     
  25. stevensrmiller

    stevensrmiller

    Joined:
    Oct 20, 2017
    Posts:
    180
    Done. I installed Unity 2019.1.1f1 to a machine that never had Unity 2019 on it before, and activated IAP. The path was, "C:/U/2019.1.1f1/Editor/Unity.exe"

    When I activate IAP in Services, it does finally ask me to run API Update. This is new behavior from what I saw with Unity 2019.1.0 when it was installed in "C:/Program Files/..."

    upload_2019-5-9_13-55-9.png
     
    AdrianoVerona_Unity likes this.
  26. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    Ok, that confirms that the problem is really the space in the folder name.

    Do you happen to have the Editor.log around? Can you share it (attach here) ?

    Thanks for your time and patience :)

    Adriano
     
  27. stevensrmiller

    stevensrmiller

    Joined:
    Oct 20, 2017
    Posts:
    180
    Where would I find that?
     
  28. stevensrmiller

    stevensrmiller

    Joined:
    Oct 20, 2017
    Posts:
    180
    Is this the one you want?
     

    Attached Files:

    AdrianoVerona_Unity likes this.
  29. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    Yep.

    And I can see that Stored.dll has been updated (based on this line from the log):

    Code (CSharp):
    1. [AssemblyUpdater] Type reference 'UnityEngine.VR.VRSettings' replaced with 'UnityEngine.XR.XRSettings' as the declaring type of 'System.Boolean UnityEngine.VR.VRSettings::get_enabled()' in 'System.Void UnityEngine.Purchasing.GooglePlayAndroidJavaStore::purchase(System.String,System.String)  {IL_0026: call System.Boolean UnityEngine.VR.VRSettings::get_enabled()}'.
    So, I do think this fixes this error:

    Code (CSharp):
    1.  
    2. Exception: Error: called non-existent method System.Boolean UnityEngine.VR.VRSettings::get_enabled()
    3.     E/Unity   (32482):   at UnityEngine.VR.VRSettings.get_enabled () [0x00000] in <filename unknown>:0
    4.     E/Unity   (32482):   at UnityEngine.Purchasing.GooglePlayAndroidJavaStore.<Purchase>b__2_0 () [0x00000] in <filename unknown>:0
    5.     E/Unity   (32482):   at UnityEngine.Purchasing.Extension.UnityUtil.Update () [0x00000] in <filename unknown>:0
    6.  
    Thanks for your help.

    Adriano
     
  30. stevensrmiller

    stevensrmiller

    Joined:
    Oct 20, 2017
    Posts:
    180
    Glad to assist. When do you think the correction will be in a version of Unity for us to download?
     
  31. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    I am sure that in 2019.2 it will be fixed.

    Other than that I'll open a back port for 2019.1 but no ETA for that, sorry

    Adriano
     
    Last edited: May 9, 2019
    stevensrmiller likes this.
  32. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,467
    So you already have the fix in place as long as you don't have a space in the installation path. I suspect your other issue is still present though, can you confirm? "The item you requested is not available for purchase" error
     
  33. stevensrmiller

    stevensrmiller

    Joined:
    Oct 20, 2017
    Posts:
    180
    That was due to my tablet being a loaner, such that Google Play thought I was trying to log in with someone else's Google account. Once I added a new account that used the Google credentials I had set for testing, it began to work fine.

    FWIW, the Unity manual describes configuration for Alpha testing and for Beta testing. I am using Internal Test Track. I don't have much Android experience yet (started all this last week, actually). But the Google Play developer's console indicated that Internal Test Track makes apps available in a few minutes, whereas my online reading suggested that uploaded APKs can take as long as a day to become available. Now, by "sideloading" my APK (that is, by not changing the Version number or the Bundle Version Code between builds, and just dragging my built APKs onto the Downloads folder when my tablet is connected to my PC), I can test changes pretty quickly. Still, if there are any advantages to using Internal Test Track, I can report that it works fine.
     
  34. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,467
    Good to hear! Yes, for IAP, you first need to download the app as a tester via Google Play, then subsequently you can side load.
     
    stevensrmiller likes this.
  35. goldenbeerus

    goldenbeerus

    Joined:
    Nov 28, 2017
    Posts:
    3
    Can Someone Please upload the fixed IAP files please.
     
  36. stevensrmiller

    stevensrmiller

    Joined:
    Oct 20, 2017
    Posts:
    180
    In re-reading my prior post, I see I was a bit vague about a point I would like to make others reading this thread aware of: Internal Test Track is a third option, in addition to Open Track (beta) and Closed Track (alpha) testing. It requires that your testers follow an opt-in link Google Play provides you. Using it, I was able to start testing a few minutes after the first time I uploaded my APK to Google Play. I have not used either of the other two options, but I have read that uploads take some time before they can be downloaded for test with those options.
     
  37. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,467
    Beta and Alpha tests also require an opt-in link.
     
  38. stevensrmiller

    stevensrmiller

    Joined:
    Oct 20, 2017
    Posts:
    180
    Do you know if Internal Track is really any faster? I'd rather use a documented approach if there are no real advantages to this one.
     
  39. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,467
  40. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,142
    Oh ok, i understand now what was going on with mine too, but I'm a bit worried since everyone normally would be installing their Unity into the Program Files folder, which have spaces in there by default.

    I would check this then on my asset and see if that solves the issue, what seems a bit weird to me is that this did not happened on Unity 2018.3x

    Thanks for the support Unity team!
     
    AdrianoVerona_Unity likes this.
  41. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    Hi

    I am fixing the issue now. I'll discuss internally how we can raise awareness of the issue to help other users figuring out if they hit the same issue.

    Unfortunately this is a regression introduced in 2019.1. I've added a test to help avoiding this to happen again.

    Best
    Adriano
     
  42. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,142
    Awesome! thanks for the update!
     
    AdrianoVerona_Unity likes this.
  43. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,142
    Hi @AdrianoVerona_Unity ,

    How is this issue going? I just got an email from user having an issue that i think is related to this on Unity 2019.1.1f1

    I pointed him to this post and also gave an option to first open it on 2018 and then back in 2019 so it have been updated by the API Updater before getting it opened on 2019.:)
     
  44. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,467
    Your user is using the 2019 Unity Editor? Did you tell them to install it to a path without a space in it?
     
  45. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,142
    Yep i did, I told him he could do that (install on a path without spaces, also pointed him to this thread) or that he could first open it on 2018 so the Updater does its job on the dlls and then open it on 2019 :D
     
  46. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,467
    I would not recommend the second approach. Allow 2019 to update it, remove and reinstall IAP if necessary to trigger the update https://forum.unity.com/threads/iap-troubleshooting-remove-and-reinstall-unity-iap.511747/
     
  47. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,142
  48. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    Hi. The fix has been implemented and are in the queue to be merged to our master dev repo. The back port was approved for 2109.2 (and it is in the queue to be merged also).

    For 2019.1 I've opened a pull request yesterday so I guess it will be approved soon.

    Adriano
     
  49. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,142
    Thanks!
     
    AdrianoVerona_Unity likes this.
  50. Wolfaks

    Wolfaks

    Joined:
    Feb 22, 2019
    Posts:
    12
    Hello. When checking in-app purchase on a real device, I have an error:
    When used in an emulator of unity, there is no such problem and everything works.
    I use unity 2018.3 and my project does not start in newer versions.

    I tried to reinstall the payment service in my project, but nothing changes.
    I ask your help in solving this problem. Thank.