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.

Thread Status:
Not open for further replies.
  1. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    I'm seeing this error in performance reporting for my recently released beta but I haven't managed to reproduce it myself.

    Unity version 2013.3.0p3
    IAP version [1.16.0] - 2018-01-25

    possibly relevant build settings:
    LL2CPP build
    'Virtual Reality Supported' is DISABLED

    Android SDK build tools 27.0.3
    Android SDK Platform 27

    Anyone else seeing this? Anyone know a fix/workaround?

    Cheers,
    Antony.

    Screen Shot 2018-02-23 at 9.25.32 AM.png
     
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    Typically, the cause of this issue is not running the API Updater when installing Unity IAP.

    In 2017.x , the VR namespace was changed to XR. Unity has an API Updater that should fix all references to changed APIs. When you install a package with an old API reference, you should be prompted to run the API Updater (and make a backup of your project first). This is required for IAP to function correctly on Android because we support In-App purchases for Google Daydream.

    I'm not sure if you'll need to enable Virtual Reality Support. That may be something worth trying if running the API Updater doesn't resolve this issue.

    We also have heard some reports of issues with IL2CPP and .NET 4.6; however, that is usually a build issue, not a runtime problem, so I don't think it is related. However, if you are using .NET 4.6, it may be something to consider.
     
  3. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Hi, thanks for the quick reply,

    I did run the API updater as I saw on another thread that it can solve similar issues. I also tried completely deleting unity IAP and reinstalling it from scratch to make sure I didn't have any older Unity IAP version's stuff laying around. When reinstalling I made sure that the project had no compile errors before importing Unity IAP and running the API updater.

    If the namespace has changed then I don't see how enabling VR would solve the issue as the namespace would still be XR would it not?
     
  4. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    Is it possible that this exception is occurring in an older build? Is the build information provided by the Performance Reporting dashboard?

    If not, it may be worth opening a support ticket and we can dig a bit more into the data.
    https://analytics.cloud.unity3d.com/support/

    Yeah, I don't think it is likely to be the problem. I've never touched that setting in any of my test apps, and they've always worked correctly on Android.
     
  5. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    The version number in all reports is the latest app version on Google Play. This is because I cleared the reports when I uploaded the latest version so older version reports were deleted.

    I'll open a support ticket.
     
  6. DavidSWu

    DavidSWu

    Joined:
    Jun 20, 2016
    Posts:
    183
    We are having the same issue. API updater does not run for us, it always fails. Did you resolve your issue?
     
  7. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    I deleted all the plugins and then reinstalled all the plugins... seems to have worked.

    Make sure you have no compile errors each step of the way.
     
    kripsonud likes this.
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, if there are any compile errors prior to updating/reimporting Unity IAP, the API updater may fail.
     
  9. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    This limitation is kind of annoying from a usability standpoint. Is there anyway to get Unity to only compile the editor scripts to run the updater? Or does it rely on reflection and other things that need all code compiled before running, if that's the case then does it fail to convert code in #def tags that are not active? For example if I import the new unity IAB when on iOS would my and any plugins' #UNITY_ANDROID code fail to update correctly?
     
  10. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    APIUpdater will take care of those when the code is actually compiled. So if you have code like:


    #if UNITY_ANDROID && !UNITY_EDITOR

    // Code here will only be updated when building the player.

    #endif


    The code will be checked/updated only when building the player

    Adriano
     
  11. DavidSWu

    DavidSWu

    Joined:
    Jun 20, 2016
    Posts:
    183
    We managed to get the API Updater to work by creating a new project, installing IAP, running API updater and copying the files to our existing project.
    Thanks for the help in this thread!
     
  12. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    531
    I'm in the same boat on this issue. I've tried this last suggestion of importing the IAP package into a fresh project and allowing the API updater to run, then replace the UnityPurchasing and UnityChannel folders in my main project but I still get this runtime error:

    Code (CSharp):
    1. Exception: Error: called non-existent method System.Boolean UnityEngine.VR.VRSettings::get_enabled()
    2. E/Unity   (32482):   at UnityEngine.VR.VRSettings.get_enabled () [0x00000] in <filename unknown>:0
    3. E/Unity   (32482):   at UnityEngine.Purchasing.GooglePlayAndroidJavaStore.<Purchase>b__2_0 () [0x00000] in <filename unknown>:0
    4. E/Unity   (32482):   at UnityEngine.Purchasing.Extension.UnityUtil.Update () [0x00000] in <filename unknown>:0
    I'm using Unity 2017.4.3, I'm just updating to 2017.4.6 to see if it's any different. I've got the latest IAP classes v1.19.0. I don't use VR??
     
  13. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @jason_yak These are exceptions on the device after you pushed a new build after the IAP import? Can you confirm that you got the API updater prompt, asking to make sure you have a backup? Also, not sure what you mean by "replace", this should be handled by the update. Did you perform any additional manual steps?
     
  14. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    531
    @JeffDUnity3D I'd followed the previous suggestion where someone had suggested to import the IAP classes into a new project allowing the API updater to run, and then copying and replacing the updated plugin files into my main project. However you might be able to confirm for me if this is a false move or not. But if not, then yes I ran the API updater over the imported package, I was prompted to run it after importing.

    note: I don't want to run the API updater unnecessarily over my entire project because it's a very huge and complex project, I have no idea what else it will do to my third party DLL's and what behavioural changes it might cause. I never run the API updater on it because I prefer to fix any API code errors myself so I know what's being changed. I don't quite understand why I even need the API updater at all... will this namespace mix up be fixed in an IAP class update? this is the thing I hate about DLL's and compiled source, I have no control over the code and things inevitably become outdated usually with no course of action available to a programmer but to wait for someone else to maybe fix it.
     
  15. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    There should be no need for additional manual steps after the update. Make a back up of your project first, then allow the API updater to run and make sure you see the dialog prompt that mentions having a back up first.
     
  16. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    531
    I'm not sure if you're following me, I have a very large project with dozens of plugins, some very old. To have quality control I can not run the API updater on my main project. It's not a viable option for me because I don't know what kinds of issues it will cause. Under normal circumstances I understand I shouldn't 'need' to do extra manual steps.... I'm saying that I don't have a choice, because I can't run the API updater on my main project. Can you verify if I were to:
    - create empty project
    - import IAP classes
    - run API updater
    - copy and paste these plugin files from this new project to my existing project

    Would you expect the files to be updated to use the XR namespace? because this seems to be my only option, and it's not working. I still get the error as described in my first message.
     
  17. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please follow my directions. Make a back of your entire project first so that it is safe to run the API updater. Otherwise, we cannot guarantee results. I would not expect your steps to work. Your last step would cause it to fail. Instead, on that last step, import your other project plugins (one at a time to ensure it compiles) but leave the UnityPurchasing and UnityChannel folders intact. But that is the long way, a better way is my original description.
     
  18. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    531
    Ok thanks for confirming that the copy and paste would not work. I use version control so I'll just run the API updater allowing it to change whatever it changes, and then revert all changes other than the IAP plugin files. That should get best of both worlds. It would take me a week to confirm that the API updater wasn't creating bugs in other plugins for every platform and build variant we support otherwise.
     
  19. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    My suggestion would at least allow you to compile and deploy your app in a matter of hours. Granted there may be run time issues later on, but it would be a good first step, perhaps in parallel with your plan.
     
  20. Friend123

    Friend123

    Joined:
    Sep 16, 2012
    Posts:
    19
    Same problem in Unity 2018.2.17f1. Five times I deleted and reinstalled an IAP plugin (last version 1.20.1), but it doesn't work. VR is nowhere used and not enabled, it's a google play application.
    How can I solve this?
     

    Attached Files:

  21. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  22. Friend123

    Friend123

    Joined:
    Sep 16, 2012
    Posts:
    19
    I made all steps from link, but question "Update API, Did you make a backup?" didn't appear. Before that was installed IAP 1.18, Unity version 2017 (not sure), IAP used first time in this project. In new blank project i don't try.
     
  23. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    If you don't get that prompt, then you would be expected to get the error. Please try in a blank project to compare.
     
  24. Friend123

    Friend123

    Joined:
    Sep 16, 2012
    Posts:
    19
    Okay, i will try it. Thanks!
     
  25. Friend123

    Friend123

    Joined:
    Sep 16, 2012
    Posts:
    19
    @JeffDUnity3D I've tried to import IAP in empty project, but promt message in step 5 haven't show
     
    Last edited: Dec 7, 2018
  26. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @Friend123 Then you have a wider issue. Can you reproduce on another computer? Are you creating your projects under C:\Users\[username]\Documents as a test to make sure it is not a permission issue? Any other differences in your system that we should be aware of? I just tested 2018.2.17f1 and got the API Update Required dialog as expected, with the "I made a backup, Go Ahead" button that I then clicked.
     
    Last edited: Dec 7, 2018
  27. Friend123

    Friend123

    Joined:
    Sep 16, 2012
    Posts:
    19
    I've tried on my second computer (windows 7 x64, administration privilegies, both - first and second), i've installed clean last Unity 2018.2.18f1, but there is same situation - no dialog.
    Why this dialog so important - there is talk about obsolete functions?
     
  28. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @Friend123 Yes, that is correct. VR has been changed to XR.
     
  29. Friend123

    Friend123

    Joined:
    Sep 16, 2012
    Posts:
    19
    Jeff, I don't understand how VR is associated with IAP?
    What else can I do?
     
  30. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    IAP works in VR too, so is supported. So you've tried on two separate computers, same behavior. We have not heard of reports of anyone else with this issue. Can you think of any differences that might be relevant? How are you installing IAP? Is this US-English Windows?
     
  31. Friend123

    Friend123

    Joined:
    Sep 16, 2012
    Posts:
    19
    This is not my project, but I asked the owner to reinstall the IAP. He reinstalled, dialog has been show and IAP did not give an error (he also has windows 7 and the latest version of Unity). The only difference is that he reinstalled with his project keys.
    But, logically, in my empty project it should have worked.

    Maybe it be usefull information.
     
  32. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You need to be a member of the organization/project to enable services.
     
  33. wtfkeklol

    wtfkeklol

    Joined:
    Feb 9, 2016
    Posts:
    5
  34. DavidZobrist

    DavidZobrist

    Joined:
    Sep 3, 2017
    Posts:
    234
    It did not work for me :(
    I spend the last 3 days working on getting the in-app to work on Android.

    I did try it with the codeless IAP and the code way.
    I did this https://forum.unity.com/threads/iap-troubleshooting-remove-and-reinstall-unity-iap.511747/

    But the problem is the API Updater thinks it is all fine.
    So with the Services -> In-app-> "Import" after the folder removal -> NO Api confirmation pop up appears.

    And hitting the purchase button on a mobile device "Android":
    MissingMethodException : bool UnityEngine.VR.VRSettings.get_enabled()

    Unity Version: 2019.1.0b.10

    Maybe related?:
    I updated from 2019.1.0b.07 and had issues with the package manager manifest.
    [com.unity.package-manager-ui@2.1.1] cannot be found

    I manipulated the manifest.json to
    "com.unity.package-manager-ui": "2.1.2",
    and since then everything worked fine with the manager.


    Full Debug:
    Non-fatal Exception: java.lang.Exception
    MissingMethodException : bool UnityEngine.VR.VRSettings.get_enabled()
    UnityEngine.Purchasing.JSONStore.Purchase (UnityEngine.Purchasing.JSONStore)
    UnityEngine.Purchasing.PurchasingManager.InitiatePurchase (UnityEngine.Purchasing.PurchasingManager)
    UnityEngine.Purchasing.PurchasingManager.InitiatePurchase (UnityEngine.Purchasing.PurchasingManager)
    UnityEngine.Purchasing.PurchasingManager.InitiatePurchase (UnityEngine.Purchasing.PurchasingManager)
    UnityEngine.Purchasing.CodelessIAPStoreListener.InitiatePurchase (UnityEngine.Purchasing.CodelessIAPStoreListener)
    UnityEngine.Purchasing.IAPButton.PurchaseProduct (UnityEngine.Purchasing.IAPButton)
    UnityEngine.Events.InvokableCall.Invoke (UnityEngine.Events.InvokableCall)
    UnityEngine.Events.UnityEvent.Invoke (UnityEngine.Events.UnityEvent)
    UnityEngine.UI.Button.Press (UnityEngine.UI.Button)
    UnityEngine.UI.Button.OnPointerClick (UnityEngine.UI.Button)
    UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.ExecuteEvents)
    UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.EventSystems.ExecuteEvents)
    UnityEngine.EventSystems.EventSystem:Update (UnityEngine.EventSystems)

     
    Last edited: Apr 6, 2019
  35. DavidZobrist

    DavidZobrist

    Joined:
    Sep 3, 2017
    Posts:
    234
    I also tried to import the iap in an empty project running under the same organization.
    Its my private pc right now and I am the only admin.

    On importing the iap via the services tab no "Update API, Did you make a backup?" appears.

    Could it be that the answer to this prompt is saved somewhere (because i might have said no the very first time) and shared to other machines via pulling the collab version of the project?
     
    Last edited: Apr 6, 2019
  36. DavidZobrist

    DavidZobrist

    Joined:
    Sep 3, 2017
    Posts:
    234
    OMG it worked....

    I pulled the project from my macbook.
    And did follow
    https://forum.unity.com/threads/iap-troubleshooting-remove-and-reinstall-unity-iap.511747/

    And oh wonder! On the macbook the prompt came as the very first pop up.
    It manipulated these two files

    Editor.dll
    Stores.dll

    After sending this change over collab to the pc editor and building the apk there.
    The test purchase pop up of google play opened the very first time!

    Such a release!!
     
  37. Chaz32621

    Chaz32621

    Joined:
    Apr 17, 2015
    Posts:
    199
    I keep getting this error so annoying:(

    MethodAccessException: Method `UnityEngine.VR.VRSettings.get_enabled()' is inaccessible from method `UnityEngine.Purchasing.GooglePlayAndroidJavaStore.Purchase(string,string)'
    04-13 11:52:10.355 13312 13355 E Unity : at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_throw_method_access(intptr,intptr)
    04-13 11:52:10.355 13312 13355 E Unity : at UnityEngine.Purchasing.GooglePlayAndroidJavaStore.Purchase (System.String productJSON, System.String developerPayload) [0x00019] in <4d0cb115fad04af59efcffe23f032975>:0
    04-13 11:52:10.355 13312 13355 E Unity : at UnityEngine.Purchasing.JSONStore.Purchase (UnityEngine.Purchasing.ProductDefinition product, System.String developerPayload) [0x00129] in <4d0cb115fad04af59efcffe23f032975>:0
    04-13 11:52:10.355 13312 13355 E Unity : at UnityEngine.Purchasing.PurchasingManager.InitiatePurchase (UnityEngine.Purchasing.Product product, System.String developerPayload) [0x0003c] in <2abeedd3020a43afa91d367b26a24e86>:0
    04-13 11:52:10.355 13312 13355 E Unity : at UnityEngine.Purchasing.PurchasingManager.InitiatePurchase (UnityEngine.Purchasing.Product product) [0x00000] in <2abeedd3020a43afa91d367b26a24e86>:0
    04-13 11:52:10.355 13312 13355 E Unity : at SIS.IAPManager.PurchaseProduct (System.St
    04-13 11:52:19.433 13312 13355 E Unity : MethodAccessException: Method `UnityEngine.VR.VRSettings.get_enabled()' is inaccessible from method `UnityEngine.Purchasing.GooglePlayAndroidJavaStore.Purchase(string,string)'
    04-13 11:52:19.433 13312 13355 E Unity : at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_throw_method_access(intptr,intptr)
     
    Last edited: Apr 13, 2019
  38. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @Chaz32621 Be sure to follow the suggestions in this thread. You must select to update the Unity API during the IAP import.
     
  39. Chaz32621

    Chaz32621

    Joined:
    Apr 17, 2015
    Posts:
    199
    Ive done everything from above other then switching to another computer.
     
  40. HermesonBF

    HermesonBF

    Joined:
    Jun 21, 2016
    Posts:
    22
    Same error here, I already tried removing and reinstalling the IAP package at least 3 times. Nothing works. And the message “I made a backup, go ahead” don’t appears.
     
  41. Chaz32621

    Chaz32621

    Joined:
    Apr 17, 2015
    Posts:
    199
    I cant really understand this one, even the Update API is greyed out so everything looks to be updated....
     
  42. HermesonBF

    HermesonBF

    Joined:
    Jun 21, 2016
    Posts:
    22
    The same here. I feel like wasting time in my projects on a simple thing like IAP, because of a possible Unity bug.
     
  43. Chaz32621

    Chaz32621

    Joined:
    Apr 17, 2015
    Posts:
    199
    Exactly I am also fairly experienced with Unity, but this seems like more then what I am doing from my side of things. Are you also using the 2019 version?
     
  44. HermesonBF

    HermesonBF

    Joined:
    Jun 21, 2016
    Posts:
    22
    Yes, I’m using the latest stable version, 2019 f2
     
  45. joshua1zn

    joshua1zn

    Joined:
    Jan 23, 2016
    Posts:
    1
    GOT SOLUTION For 2019 users:
    I tried this with Unity2019.1.0f2 and the "Update API, Did you make a backup?" popup didn't appear.

    Tried creating a new project with Unity2018.3.10f1 in Documents folder and the "Update API, Did you make a backup?" popup appeared. I then took the UDP, UnityChannel, and UnityPurchasing folder and pasted it in my 2019 project.
    Before pasting the updated folders delete the existing 3 folders from your 2019 project. I built and ran it on my device and it worked.

    One thing i noticed is after building and running it on my device without publishing the apk on google play console. The IAP popup still appeared and i was able to make a test purchase. So if you wana test it just do a build and run onto your device but make sure you set up the testers accounts under account settings and alpha testers accounts under alpha release in google play console. oh and of course make sure you setup the in app products. number of products used in unity should be same as number of products added to google play console otherwise Unity IAP won't initialize properly and the button won't work.

    EDIT: I Mean Create a new project with Unity2018.3.10f1 enable IAP and Import files then you should get the popup.

    Cheers :D
     
    Last edited: Apr 23, 2019
  46. HermesonBF

    HermesonBF

    Joined:
    Jun 21, 2016
    Posts:
    22
    That worked! Thank you.
     
    Last edited: Apr 23, 2019
  47. Chaz32621

    Chaz32621

    Joined:
    Apr 17, 2015
    Posts:
    199
    Interesting, I used the 2019.1 build and my project was in 2019.2. I will try this way and report back. Didn't even think about doing it this way but wow might be helpful! Thanks!
     
  48. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Hi.

    Can you do me a favor? Create a small repo project and file a bug (and share the bug id) ? If possible include also Unity.log when you open the project in 2018.3 (and it worked).
     
  49. Chaz32621

    Chaz32621

    Joined:
    Apr 17, 2015
    Posts:
    199
    He dosnt open the project from 2019 to 2018. He creates an entirely new project from 2018 and takes those iap import files and copies them into the existing 2019 project. Yall dropped the ball on this one just a little. Hopefully no one imports iap into a 2019 it's broken.
     
  50. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    that is exactly what I want :)

    The Editor.log for the project in 2018.3 and a simple repro project that I can open in 2019 and investigate.

    Adriano
     
    quimbytron likes this.
Thread Status:
Not open for further replies.