Forum Discussion
Soundmartell
8 years agoExplorer
OVRGazePointer error
Hello, I have been using the OVRGazePointer.cs without having any error till I update Unity to 2017.0.0f3.
Now I am getting this error:
Now I am getting this error:
NullReferenceException: Object reference not set to an instance of an object
OVRGazePointer.LateUpdate () (at Assets/OVR/Scripts/Util/OVRGazePointer.cs:247)
I will appreciate any help.
I will appreciate any help.
8 Replies
Replies have been turned off for this discussion
- SoundmartellExplorerHello,
Unity v2017.3.0f3, Oculus Utilities v1.21.0
Mac OS Hight Sierra. - tamer_ozturk2Explorer
This error is because you are using the utility inputmodule script but you have no gazepointer prefab in your scene. The utility script is faulty and calling for the instance variables before the gazepointer is actually initialized.
You will recieve this error once or twice at the beginning and then after the gazepointer will be initialized, you wont see it anymore.
I suggest to write your own gazepointer script anyhow.
- SoundmartellExplorer
tamer.ozturk2 said:
This error is because you are using the utility inputmodule script but you have no gazepointer prefab in your scene. The utility script is faulty and calling for the instance variables before the gazepointer is actually initialized.
You will recieve this error once or twice at the beginning and then after the gazepointer will be initialized, you wont see it anymore.
I suggest to write your own gazepointer script anyhow.
Thank you but this error never happen before in the project. I do have a Gazepoiter prefab. The error doesn't appear once or twice but infinity.
Regards. - tamer_ozturk2Explorer
Soundmartell said:
tamer.ozturk2 said:
This error is because you are using the utility inputmodule script but you have no gazepointer prefab in your scene. The utility script is faulty and calling for the instance variables before the gazepointer is actually initialized.
You will recieve this error once or twice at the beginning and then after the gazepointer will be initialized, you wont see it anymore.
I suggest to write your own gazepointer script anyhow.
Thank you but this error never happen before in the project. I do have a Gazepoiter prefab. The error doesn't appear once or twice but infinity.
Regards.
So, you do the reasonable and check the line 247 which is; Quaternion trailRotation = trailFollower.rotation;if this is null error, that means you dont have a trailFollower object as a child of your gazepointer object.
- markncolleen198ProtegeHI, i also have this error. unity 2017.2.1f1 Ovr plugin 1.21.0
How to replicate:
1) Load up the tutorial from page:
https://developer.oculus.com/blog/unitys-ui-system-in-vr/
2) Open the demo scene VRPointers press play - tamer_ozturk2Explorer
markncolleen1985 said:
HI, i also have this error. unity 2017.2.1f1 Ovr plugin 1.21.0
How to replicate:
1) Load up the tutorial from page:
https://developer.oculus.com/blog/unitys-ui-system-in-vr/
2) Open the demo scene VRPointers press play
When you upgrade to 1.21 or any other new version, first thing to do is to check the included scenes rather than blog posts. Because blog posts are old and as far as i understand oculus is not very fast at updating scattered documents.Like i said above, the new script requires a different OVRGazePointerRing prefab which has a trailFollower object in its hierarchy as well.
Nevermind the blog tutorial, and open the UI Scene provided in OVR Utilities scenes. Check the OVRGazePointer there and you will see trailFollower.
***********
I am also just learning this oculus vr thing, ive had the same errors as you did, but i read the whole code and understood whats going on now. My humble suggestion is:
Rewrite the following scripts to suit your own game and also fix bugs, because them as in their current form are just hastily written unoptimised scripts but still a good learning material:
OVRInputModule, OVRRayCaster, OVRPhysicsRayCaster, OVRMousePointer, OVRGazePointer
Just to give you an idea forexample, if you change OVRRayCaster.cs line 211 into this:
if (graphic.depth == -1 || !graphic.raycastTarget || (pointer == graphic.gameObject))
Then, you will be able to use the RaycastTarget variable in your UI items, but it is currently missing...etc
- sid1314Honored Guest
Soundmartell said:
Hello, I have been using the OVRGazePointer.cs without having any error till I update Unity to 2017.0.0f3.
Now I am getting this error:NullReferenceException: Object reference not set to an instance of an objectOVRGazePointer.LateUpdate () (at Assets/OVR/Scripts/Util/OVRGazePointer.cs:247)
I will appreciate any help.
Its to do with the Script OVRGazePointer. Its looking for "GazeIcon" Gameobject for the the Gaze Pointer image.
If you change the script and change the variable GazeIcon from a private Transform to a public Transform and delete the line where the GazeIcon searches for the GameObject, you can manually assign the GazeIcon in the Inspector. - Anonymous@sid1314: your solution worked for resolving the error. Here I have attached screenshot of what to assign to "GazeIcon"
successfully worked on n Oculus GO
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 5 months ago
- 3 years ago