{"record":{"id":"498965b2beb5eba2","repo":"stride3d/stride","slug":"failed-to-create-openvr-overlay","errorCode":null,"errorMessage":"Failed to create OpenVR overlay.","messagePattern":"Failed to create OpenVR overlay\\.","errorType":"exception","errorClass":"System.Exception","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.VirtualReality/OpenVR/OpenVROverlay.cs","lineNumber":19,"sourceCode":"// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)\n// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.\n#if STRIDE_GRAPHICS_API_DIRECT3D11\n\nusing Stride.Core.Mathematics;\nusing Stride.Graphics;\n\nnamespace Stride.VirtualReality\n{\n    internal class OpenVROverlay : VROverlay\n    {\n        private ulong overlayId;\n\n        public OpenVROverlay()\n        {\n            overlayId = OpenVR.CreateOverlay();\n            if (overlayId == 0)\n            {\n                throw new System.Exception(\"Failed to create OpenVR overlay.\");\n            }\n\n            OpenVR.InitOverlay(overlayId);\n            OpenVR.SetOverlayEnabled(overlayId, true);\n        }\n\n        public override void Dispose()\n        {           \n        }\n\n        private bool enabled = true;\n\n        public override bool Enabled\n        {\n            get\n            {\n                return enabled;\n            }","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.VirtualReality/OpenVR/OpenVROverlay.cs#L1-L37","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// C#\nbool vrReady = OpenVR.IsRuntimeInstalled() && OpenVR.IsHmdPresent() && openvrInitialized;","typeGuard":null,"tryCatchPattern":"// C#\nOpenVROverlay overlay = null;\ntry { overlay = new OpenVROverlay(); }\ncatch (Exception ex) { Logger.Warning(\"OpenVR overlay unavailable: \" + ex.Message); }","preventionTips":["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"],"tags":["vr","openvr","overlay","initialization"],"backgroundTag":"module-init-failed","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}