Search code examples
c#unity-game-enginesteamvr

Unity SteamVR Controller Initialization Issue on Build


So I've created a game that functions perfectly in the editor, however when I build it, it throws me a NullReferenceException error. The Log tells me it is within the Initialize() function but since it is only an issue on build I don't really have any clue on how to fix it. I dont know what would be different between the build and the editor so I don't know how to bug test it effectively.

Unity begins to initialize the controllers, but then throws this massive block of errors.

<b>[SteamVR]</b> System.NullReferenceException: Object reference not set to an instance of an object.
  at Valve.VR.SteamVR_Input.Initialize (System.Boolean force) [0x00039] in E:\Repos\Mors Oculus\Assets\SteamVR\Input\SteamVR_Input.cs:166 
  at Valve.VR.SteamVR.CreateInstance () [0x000e7] in E:\Repos\Mors Oculus\Assets\SteamVR\Scripts\SteamVR.cs:207 
  at Valve.VR.SteamVR.Initialize (System.Boolean forceUnityVRMode) [0x00023] in E:\Repos\Mors Oculus\Assets\SteamVR\Scripts\SteamVR.cs:103 
  at Valve.VR.SteamVR_Behaviour_Pose.OnEnable () [0x00002] in E:\Repos\Mors Oculus\Assets\SteamVR\Input\SteamVR_Behaviour_Pose.cs:88 
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
Valve.VR.SteamVR:CreateInstance() (at E:\Repos\Mors Oculus\Assets\SteamVR\Scripts\SteamVR.cs:217)
Valve.VR.SteamVR:Initialize(Boolean) (at E:\Repos\Mors Oculus\Assets\SteamVR\Scripts\SteamVR.cs:103)
Valve.VR.SteamVR_Behaviour_Pose:OnEnable() (at E:\Repos\Mors Oculus\Assets\SteamVR\Input\SteamVR_Behaviour_Pose.cs:88)

I don't really know what to change. Does anyone have any ideas?


Solution

  • I replaced the entire SteamVR_Input folder with a fresh one and it worked.