stride3d/stride · error · System.Exception

Failed to create OpenVR overlay.

Error message

Failed to create OpenVR overlay.

What it means

The OpenVROverlay constructor requests a new overlay handle via OpenVR.CreateOverlay. SteamVR overlays are identified by nonzero handles, so a return value of 0 means the runtime refused to create the overlay, and the constructor throws System.Exception("Failed to create OpenVR overlay.") before any further overlay calls.

Solutions

  1. Start SteamVR and connect the headset before constructing the overlay.
  2. Ensure OpenVR is fully initialized (Init succeeded) before creating overlays; check earlier Init errors.
  3. Retry overlay creation after the runtime is up; handle the exception to degrade gracefully to non-VR rendering.
  4. Verify the OpenVR native runtime (openvr_api) version matches the one Stride expects.
Defensive patterns

Strategy: try-catch

Validate before calling

// C#
bool vrReady = OpenVR.IsRuntimeInstalled() && OpenVR.IsHmdPresent() && openvrInitialized;

Try / catch

// C#
OpenVROverlay overlay = null;
try { overlay = new OpenVROverlay(); }
catch (Exception ex) { Logger.Warning("OpenVR overlay unavailable: " + ex.Message); }

Prevention

When it happens

Trigger: Constructing OpenVROverlay when OpenVR.CreateOverlay returns 0 — e.g. SteamVR not running, OpenVR.Init not called (or failed) before overlay creation, or the runtime rejecting the request.

Common situations: No headset/SteamVR installed or runtime shut down; calling overlay code before OpenVR initialization completes; running on a machine without VR support; OpenVR API version mismatch.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/498965b2beb5eba2. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.VirtualReality/OpenVR/OpenVROverlay.cs:19

// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
#if STRIDE_GRAPHICS_API_DIRECT3D11

using Stride.Core.Mathematics;
using Stride.Graphics;

namespace Stride.VirtualReality
{
    internal class OpenVROverlay : VROverlay
    {
        private ulong overlayId;

        public OpenVROverlay()
        {
            overlayId = OpenVR.CreateOverlay();
            if (overlayId == 0)
            {
                throw new System.Exception("Failed to create OpenVR overlay.");
            }

            OpenVR.InitOverlay(overlayId);
            OpenVR.SetOverlayEnabled(overlayId, true);
        }

        public override void Dispose()
        {           
        }

        private bool enabled = true;

        public override bool Enabled
        {
            get
            {
                return enabled;
            }

View on GitHub (pinned to 96fad776d2)