cancel
Showing results for 
Search instead for 
Did you mean: 

Error when loading in Oculus Utilities for Unity

Zucchini_Fred
Explorer
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!
33 REPLIES 33

luks0r
Explorer
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

mitchellhart
Honored Guest
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? 🙂

luks0r
Explorer
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.

mouse_bear
Retired Support
@Zucchini_Fred Thanks for the heads up! I'm assuming this is happening with the latest Oculus Utilities version 1.27?

luks0r
Explorer
@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!

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

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

kersk
Meta Employee
Hi all, is everyone affected here running the Unity Editor on macOS?

pewpewresearch
Honored Guest
I am affected by this bug on macOS, and I can confirm @luks0r's fix worked for me.