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

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.

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.

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?

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.

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.

We are having the same issue. API updater does not run for us, it always fails. Did you resolve your issue?

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.

1 Like

Yes, if there are any compile errors prior to updating/reimporting Unity IAP, the API updater may fail.

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?

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

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!

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:

Exception: Error: called non-existent method System.Boolean UnityEngine.VR.VRSettings::get_enabled()
E/Unity   (32482):   at UnityEngine.VR.VRSettings.get_enabled () [0x00000] in <filename unknown>:0
E/Unity   (32482):   at UnityEngine.Purchasing.GooglePlayAndroidJavaStore.<Purchase>b__2_0 () [0x00000] in <filename unknown>:0
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??

@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?

@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.

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.

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.

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.

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.

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.

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?