Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
eyal_maoz_5's avatar
eyal_maoz_5
Honored Guest
6 years ago

LaserPointer doesnt work after switching scenes.

Hello everyone,
I am using Unity 2018.4.19f version with the 14v version of Oculus Integration, developing an app for the Oculus Quest.
I have 2 scenes in my project, one for the menu and one for the game itself, when separated they work perfectly but when trying moving from one to another i have a weird problem where the laser pointer doesn't work anymore when hitting the canvas, its a bit hard to explain so i took a video here:
https://www.youtube.com/watch?v=KWEoXGQi0-8&feature=youtu.be
What i did was - at that specific screen (Lets call it main scene) i pressed "Continue treatment plan"  which loaded the game scene, every thing works fine, and than i load back the main scene and that how it works.
The things is that i have a "MainCanvas" object that contains the canvas and all other canvas in main scene, which i dont destroy because of data needed. i just hide the MainCanvas every other scene loading.
So I feel like this bug is somehow affected by the DontDestory... some of the Oculus scripts handling the input use the Start or Awake function and when loading back the main scene they do not call those function again which probably cause this to not respond the laser pointer...
this is the main scene: (I dont destory the main canvas, the main canvas also has the script "OVRRayCaster")

In the game scene i also have a Canvas with "OVRRayCaster" attached to it:


*The EventSystem and the OVRCameraRig is different in each scene *
So if you have any ideas where this could come from it would be a blast. Thank you!

1 Reply

  • Update: Found the problem! the MainCanvas camera becomes null when i return to the MainScene so i just reassign it when its become null (i check it in the OVRRaycaster update function)