Recenter the view during runtime in Unity

Give us as much detail as possible regarding the issue you're experiencing.

Unity Editor version: 2022.2.0f1
ML2 OS version:
MLSDK version: 1.2.0-dev2
Host OS: (/MacOS)

I am building a Unity app but I am having constant view issue when testing it using App-sim and after installation. This happens quite often: after removing my headset and putting it back, the camera in Unity (input is from centereyerotation) is set to a rotation value even when I am looking straight. The only way I know so far to recenter the view is using the home button on the controller. But this won't work when running an App. I am wondering if there is any way to recenter the headset to the direction I am facing during runtime in Unity?

Thanks in advance!

Hi Ethan,

Welcome to the forum! If you're using the XR Rig prefab from the MagicLeap Unity sdk- there is a MagicLeapCamera component on the Main Camera game object.

If you enable the "Recenter XR Origin At Start" property, then the XR origin will be set to the scene origin in Unity world space when the app launches-

Please let us know if that doesn't provide the behavior that you are trying to achieve.


1 Like