ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
6.14k stars 1.28k forks source link

Init_PathRegistryNotFound with c# #1816

Open AlexanderAchberger opened 9 months ago

AlexanderAchberger commented 9 months ago

Hi all,

I am trying to Initialize openvr in a own c# application. I added the openvr_api.dll and openvr_api.cs file in my project and tried to initialize openVR:

...
using Valve.VR;

public MainPage()
{
    this.InitializeComponent();
    EVRInitError error = EVRInitError.None;

    CVRSystem  CVR = Valve.VR.OpenVR.Init(ref error, EVRApplicationType.VRApplication_Utility);
    if (error is EVRInitError.None)
    {

    }
}

However, error is always Init_PathRegistryNotFound. My steamVr it turned on and my HMD is detected. Unity applications are also working with SteamVR.

Is there something I am doing wrong? Do I have to assign a path somewhere?

Thanks a lot.

AlexanderAchberger commented 9 months ago

I checked the code and discovered the problem is the function CVRPathRegistry_Public::GetPaths . Here it tries to open and read the file openvrpaths.vrpath in my local app data folder. On my system, the file exists and contains path information. I do not understand why CVRPathRegistry_Public::GetPaths does not find that file.

However, if I set the environment variables VR_OVERRIDE VR_CONFIG_PATH VR_LOG_PATH I am receiving the error VRInitError_Init_NoLogPath.

Any ideas what the problem could be?