cancel
Showing results for 
Search instead for 
Did you mean: 

NullReferenceException from Oculus package

eggyegg
Honored Guest
The Oculus package itself raises this error when I try to run my project:
NullReferenceException: Object reference not set to an instance of an object
OculusSampleFrameworkUtil.HandlePlayModeState (UnityEditor.PlayModeStateChange state) (at Assets/Oculus/SampleFramework/Editor/OculusSampleFrameworkUtil.cs:43)
UnityEditor.EditorApplication.Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange state) (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorApplication.cs:302)

How do I fix this?
13 REPLIES 13

TriplePete
Protege
Same here on Mac - any solutions?

chazubwre
Honored Guest
Same, on Mac, out of nowhere, can't think what changes might have impacted to do this. Been running Unity 2019.3.9f1 for a couple of days with no probs.... this is wasting a lot of time now... Thought this might have been due to new XR plugin, so removed it, found old Oculus Integration, but same error... 

kndol
Honored Guest
I fix this problem:

filnd below lines  in OVRPlugin.cs:

private const string pluginName = "OVRPlugin";
private static System.Version _versionZero = new System.Version(0, 0, 0);

and move them to line 43 (my version is 18.0.0).

43: private const string pluginName = "OVRPlugin";
44: private static System.Version _versionZero = new System.Version(0, 0, 0);
45: 
46: #if OVRPLUGIN_UNSUPPORTED_PLATFORM
47:     public static readonly System.Version wrapperVersion = _versionZero;
48: #else
49:     public static readonly System.Version wrapperVersion = OVRP_1_49_0.version;
50: #endif


Anonymous
Not applicable

I am working with Unity version 2019.2.5f1 and this solution worked. If you use this solution make sure to put these two lines in OVRPluggin.cs under line 40 that says:


37:  // Internal C# wrapper for OVRPlugin.

39:  public static class OVRPlugin
40:  {

43: private const string pluginName = "OVRPlugin";
44: private static System.Version _versionZero = new System.Version(0, 0, 0);


Also, make sure to delete the other two lines of code that you copied or you will get errors in lines that have "_versionZero" 


kndol said:

I fix this problem:

filnd below lines  in OVRPlugin.cs:

private const string pluginName = "OVRPlugin";
private static System.Version _versionZero = new System.Version(0, 0, 0);

and move them to line 43 (my version is 18.0.0).

43: private const string pluginName = "OVRPlugin";
44: private static System.Version _versionZero = new System.Version(0, 0, 0);
45: 
46: #if OVRPLUGIN_UNSUPPORTED_PLATFORM
47:     public static readonly System.Version wrapperVersion = _versionZero;
48: #else
49:     public static readonly System.Version wrapperVersion = OVRP_1_49_0.version;
50: #endif