Unity: SteamVR Center View

The Unity [SteamVR Plugin] has an API to center the VR view. It’s great when VR apps have a key mapped to do this.

using UnityEngine;
using Valve.VR;

public class SteamVRRecenter : MonoBehaviour
{
    // Keep the script around
    private void Start()
    {
        DontDestroyOnLoad(gameObject);
    }

    // Update is called once per frame
    void FixedUpdate()
    {
        if (Input.GetKeyUp(KeyCode.L))
        {
            var system = OpenVR.System;
            if (system != null)
            {
                system.ResetSeatedZeroPose();
            }
        }
    }
}