Developer Log

A Peek Behind The Curtain

VRTK/Oculus Integration Bug

I’m writing this quick blog entry as a reminder to myself and as a helpful tip for other developers who may run into a similar bug.

While integrating the “Oculus Integration” package into my Unity project I came across a frustrating set of errors/bugs related to the communication between the Oculus package and the VRTK package I already had built into the project.

After an unsuccessful bit of trial and error trying to solve the problem through various approaches, I finally just cracked open the VRTK code to find the errors at their source. Usually I try to avoid altering code I did not write myself, since I want to avoid accidentally causing new errors in connectivity somewhere else in the code base.

It turns out that this particular error appeared to be a result of recent changes made to the Oculus code. Recently Oculus announced that they would no longer be supporting their outdated “GearVR” headsets. This change has been reflected in their unity plugin code as well. The VRTK code does not appear to have recieved a similar update since the change. This resulted in VRTK failing to find Oculus GearVR code in the Oculus plugin, and thus caused compiler errors when both packages are integrated into the same unity project.

Luckily for us, the fix is very simple. The code errors appear in a set of enums appearing in a few places in the VRTK code. Commenting out any of the enum elements related to GearVR will fix the error, while still allowing the VRTK code to function as intended while dealing with other VR headset types.

Below I will include images of these commented out code sections, as well as listings of the scripts and line numbers these sections correspond to. Although these lines may be slightly different from project to project, it should at least give you a ball park idea of where to start looking if you find yourself wrestling with this same set of errors.

 

This first image shows the commented out sections of code being lines 78-82 in the SDK_OculusHeadset.cs script.

 

 

This second image shows the commented out sections of code being lines 832-837 in the SDK_OculusControllers.cs script.

 

 

This third image shows the commented out sections of code being lines 107-115 in the SDK_OculusControllers.cs script.

 

After commenting these sections of code out, I found that the errors vanished and my project returned to working smoothly and as expected. I hope this entry helps you move past this frustrating set of errors.

 

 

Previous

New Features For The SaDVR (Strike and Dip Virtual Reality) Tool

Next

Field Maps For The SaD (Strike and Dip) Tool

1 Comment

  1. ButterBean

    Thank you so much for writing this.

Leave a Reply

Powered by WordPress & Theme by Anders Norén

Skip to toolbar