Skip to main content
New Participant
June 21, 2018

Error when loading in Oculus Utilities for Unity

Hi,

When I load in the Oculus Utilities for Unity, I immediately have an error in one of the scripts which reads "Assets/Oculus/VR/Scripts/OVRPlugin.cs(2876,18): error CS0103: The name `OVRP_1_15_0' does not exist in the current context"
How can I deal with this error? Is there a way to locate OVRP or is that no longer a part of the oculus utilities?
Thank You!
This topic has been closed for replies.

33 replies

slukasxr
Participant
June 22, 2018
I saw this too! I followed the #define code and saw that in the editor, the class definition is #if’ed out, so just do the same by wrapping 

#if !OVRPLUGIN_UNSUPPORTED_PLATFORM
#endif

around the statement groups that are erroring, then you should be on your way!

I can post the actual lines of code when i get to a computer if you need it. Let me know?

UPDATE:
Corrected to read #if !OVRPLUGIN_UNSUPPORTED_PLATFORM
as it works more accurately than the previously suggested #if !UNITY_EDITOR
New Participant
June 22, 2018
I'm having the same error. I located the class definition, (private static class OVRP_1_15_0) but mine isn't wrapped in an #if statement. Any ideas? :)
slukasxr
Participant
June 22, 2018
Alright Ocularians, here goes:

Culprits are all in OVRPlugin.cs:
#if !OVRPLUGIN_UNSUPPORTED_PLATFORM
Roughly line 2948. This says "If not a supported platform, do not declare the OVRP_0_X_X classes".

#if !(UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || (UNITY_ANDROID && !UNITY_EDITOR))
#define OVRPLUGIN_UNSUPPORTED_PLATFORM
#endif
Line 22-24. These determine if you're on a supported platform or not. If Unity Android target while using the Unity Editor (Play Mode), this makes you in "not supported platform mode", and thus the OVRP_0_X_X classes have not been declared.

These were not #if'ed out properly, causing the errors. The fixes are all the same, but here's one sample. Add the Bold Italic lines like this around each set of offending code.

    #if !OVRPLUGIN_UNSUPPORTED_PLATFORM
        if (version >= OVRP_1_15_0.version)
        {
            Result result = OVRP_1_15_0.ovrp_GetNodeFrustum2(nodeId, out frustum);
            if (result != Result.Success)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
        else
    #endif
        {
            return false;
        }


Then your scripts should compile and back to dev'ing.

mousebear
Honored Contributor
June 22, 2018
@Zucchini_Fred Thanks for the heads up! I'm assuming this is happening with the latest Oculus Utilities version 1.27?
If you need immediate help or want additional support/context on an issue you are having with our platform or integrations: 1. Gather any and all logs , screenshots, and version numbers of relevant software (Oculus SDK, engine, etc.) 2. Please submit a ticket here through the "Contact Us" link (include what you've gathered in step 1). 3. Tag me @mouse_bear once you have done so!
slukasxr
Participant
June 22, 2018
@NinjaGaijin

Yup! Just re-downloaded it to reconfirm this. The fix is simply to add these line pairs:

#if !OVRPLUGIN_UNSUPPORTED_PLATFORM
#endif
at lines:
2876 / 2890,
2901 / 2917,
2928 / 2936

to OVRPlugin.cs

(these are the line numbers once they're added sequentially). Keep the #endif just after the "else", and then the subsequent "{ return false; }" block works very nicely. (as illustrated in my previous post)

Thanks!

New Participant
June 23, 2018
@luks0r

That fix worked for me but now I'm getting an error related to
"




private const string pluginName = "OVRPlugin"; "
 

Assets/Oculus/VR/Scripts/OVRPlugin.cs(2994,9): error CS1525: Unexpected symbol `const', expecting `class', `delegate', `enum', `interface', `partial', or `struct'

did this happen to you as well?
slukasxr
Participant
June 23, 2018
@Zucchini_Fred hmm no, best advice I’d say is check to make sure you’ve properly placed your #endif statements. Try reverting to the error'ed version to get back to the "3 errors" state, then #if out one block at a time and see if it removes your error messages one by one.
Meta Employee
June 25, 2018
Hi all, is everyone affected here running the Unity Editor on macOS?
New Participant
June 26, 2018
I am affected by this bug on macOS, and I can confirm @luks0r's fix worked for me.
New Participant
June 26, 2018
Yes, MacOS here. Happens on an empty project.