From 5dbaef721b0c3e48ef39ecc2561ea08f0024d50f Mon Sep 17 00:00:00 2001 From: Kornei Dontsov Date: Mon, 16 Jan 2023 19:58:55 +0300 Subject: [PATCH] [Unity3D-sdk] Fix isVRSupported error in Unity 5 This commit fixes the compile errors: - Unity 5.0: ```Assets/PocoSDK/VRSupport.cs(42,44): error CS0234: The type or namespace name `VR' does not exist in the namespace `UnityEngine'. Are you missing an assembly reference?``` - Unity 5.1-5.3: ```Assets/PocoSDK/VRSupport.cs(42,58): error CS0117: `UnityEngine.VR.VRSettings' does not contain a definition for `loadedDeviceName'``` Property UnityEngine.VR.VRSettings.loadedDeviceName was released in Unity 5.4: https://docs.unity3d.com/540/Documentation/ScriptReference/VR.VRSettings-loadedDeviceName.html --- Unity3D/VRSupport.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Unity3D/VRSupport.cs b/Unity3D/VRSupport.cs index 47cd0e1..0972cc9 100644 --- a/Unity3D/VRSupport.cs +++ b/Unity3D/VRSupport.cs @@ -36,10 +36,10 @@ public void PeekCommand() public object isVRSupported(List param) { -#if UNITY_3 || UNITY_4 - return false; -#elif UNITY_5 || UNITY_2017_1 - return UnityEngine.VR.VRSettings.loadedDeviceName.Equals("CARDBOARD"); +#if !UNITY_5_4_OR_NEWER + return false; +#elif !UNITY_2017_2_OR_NEWER + return UnityEngine.VR.VRSettings.loadedDeviceName.Equals("CARDBOARD"); #else return UnityEngine.XR.XRSettings.loadedDeviceName.Equals("CARDBOARD"); #endif