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
- Start SteamVR and connect the headset before constructing the overlay.
- Ensure OpenVR is fully initialized (Init succeeded) before creating overlays; check earlier Init errors.
- Retry overlay creation after the runtime is up; handle the exception to degrade gracefully to non-VR rendering.
- 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
- Start SteamVR before creating overlays
- Only create overlays after OpenVR Init has succeeded
- Handle overlay creation failure so the app still renders without VR overlays
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
- OculusOvr.GetError()
- OculusOvr.GetError()
- Cannot allocate SDL Window:
- Cannot register new platforms. RegisterSupportedPlatforms…
- ContinuousCollisionDetection must be enabled at physics…
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)