private void SetupIntegration(bool logOutput = true) { CurrentIntegrationType = DetermineCurrentIntegration(logOutput); if (CurrentIntegrationType == NVRSDKIntegrations.Oculus) { Integration = new NVROculusIntegration(); } else if (CurrentIntegrationType == NVRSDKIntegrations.SteamVR) { Integration = new NVRSteamVRIntegration(); } else if (CurrentIntegrationType == NVRSDKIntegrations.FallbackNonVR) { if (logOutput) { Debug.LogError("[NewtonVR] Fallback non-vr not yet implemented."); } } else { if (logOutput) { Debug.LogError("[NewtonVR] Critical Error: Oculus / SteamVR not setup properly or no headset found."); } } }
private void DetermineCurrentIntegration() { string resultLog = "[NewtonVR] Version : " + NewtonVRVersion + ". "; if (VRDevice.isPresent == true) { resultLog += "Found VRDevice: " + VRDevice.model + ". "; #if NVR_Oculus if (VRDevice.model.IndexOf("oculus", System.StringComparison.CurrentCultureIgnoreCase) != -1) { CurrentIntegrationType = NVRSDKIntegrations.Oculus; resultLog += "Using Oculus SDK"; return; } #endif #if NVR_SteamVR CurrentIntegrationType = NVRSDKIntegrations.SteamVR; resultLog += "Using SteamVR SDK"; return; #endif } if (CurrentIntegrationType == NVRSDKIntegrations.None && DEBUGEnableFallback2D == true) { CurrentIntegrationType = NVRSDKIntegrations.FallbackNonVR; resultLog += "Did not find supported VR device. Or no integrations enabled."; } Debug.Log(resultLog); }
private NVRSDKIntegrations DetermineCurrentIntegration(bool logOutput = true) { NVRSDKIntegrations currentIntegration = NVRSDKIntegrations.None; string resultLog = "[NewtonVR] Version : " + NewtonVRVersion + ". "; if (UnityEngine.XR.XRDevice.isPresent == true) { resultLog += "Found VRDevice: " + UnityEngine.XR.XRDevice.model + ". "; #if !NVR_Oculus && !NVR_SteamVR && !NVR_WindowsMR string warning = "Neither SteamVR or Oculus SDK is enabled in the NVRPlayer. Please check the \"Enable SteamVR\" or \"Enable Oculus SDK\" checkbox in the NVRPlayer script in the NVRPlayer GameObject."; Debug.LogWarning(warning); #endif #if NVR_Oculus if (VRDevice.model.IndexOf("oculus", System.StringComparison.CurrentCultureIgnoreCase) != -1) { currentIntegration = NVRSDKIntegrations.Oculus; resultLog += "Using Oculus SDK"; } #endif #if NVR_SteamVR if (currentIntegration == NVRSDKIntegrations.None) { currentIntegration = NVRSDKIntegrations.SteamVR; resultLog += "Using SteamVR SDK"; } #endif #if UNITY_WSA if (currentIntegration == NVRSDKIntegrations.None) { currentIntegration = NVRSDKIntegrations.WindowsMR; resultLog += "Using WindowsMR SDK"; } #endif } if (currentIntegration == NVRSDKIntegrations.None) { if (DEBUGEnableFallback2D == true) { currentIntegration = NVRSDKIntegrations.FallbackNonVR; } else { resultLog += "Did not find supported VR device. Or no integrations enabled."; } } if (logOutput == true) { Debug.Log(resultLog); } return(currentIntegration); }
private NVRSDKIntegrations DetermineCurrentIntegration(bool logOutput = true) { NVRSDKIntegrations currentIntegration = NVRSDKIntegrations.None; string resultLog = "[NewtonVR] Version : " + NewtonVRVersion + ". "; string deviceName = null; if (XRDevice.isPresent == true) { deviceName = XRDevice.model; } if (deviceName != null) { resultLog += "Found VRDevice: " + deviceName + ". "; if (XRDevice.model.IndexOf("oculus", System.StringComparison.CurrentCultureIgnoreCase) != -1) { currentIntegration = NVRSDKIntegrations.UnityXR; resultLog += "Using Oculus via UnityEngine.XR"; } else if (XRDevice.model.IndexOf("vive", System.StringComparison.CurrentCultureIgnoreCase) != -1) { currentIntegration = NVRSDKIntegrations.UnityXR; resultLog += "Using Vive via UnityEngine.XR"; } #if UNITY_PS4 if (currentIntegration == NVRSDKIntegrations.None) { currentIntegration = NVRSDKIntegrations.PSVR; resultLog += "Using PSVR SDK"; } #endif } if (currentIntegration == NVRSDKIntegrations.None) { if (DEBUGEnableFallback2D == true) { currentIntegration = NVRSDKIntegrations.FallbackNonVR; } else { resultLog += "Did not find supported VR device. Or no integrations enabled."; } } if (logOutput == true) { Debug.Log(resultLog); } return(currentIntegration); }
private void SetupIntegration(bool logOutput = true) { CurrentIntegrationType = DetermineCurrentIntegration(logOutput); if (CurrentIntegrationType == NVRSDKIntegrations.Oculus) { Integration = new NVROculusIntegration(); } else if (CurrentIntegrationType == NVRSDKIntegrations.Gear) { Integration = new NVRGearIntegration(); } else if (CurrentIntegrationType == NVRSDKIntegrations.SteamVR) { Integration = new NVRSteamVRIntegration(); } else if (CurrentIntegrationType == NVRSDKIntegrations.Daydream) { Integration = new NVRDaydreamIntegration(); } else if (CurrentIntegrationType == NVRSDKIntegrations.FallbackNonVR) { if (logOutput == true) { Debug.LogError("[NewtonVR] Fallback non-vr not yet implemented."); } return; } else { if (logOutput == true) { #if !UNITY_EDITOR || NVR_Oculus Debug.LogError("[NewtonVR] Critical Error: Oculus / SteamVR not setup properly or no headset found."); #endif } return; } }