Skip to content

Commit

Permalink
[Unity3D-sdk] Fix isVRSupported error in Unity 5
Browse files Browse the repository at this point in the history
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
  • Loading branch information
KorneiDontsov committed Jan 18, 2023
1 parent 4a9e388 commit 5dbaef7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Unity3D/VRSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public void PeekCommand()

public object isVRSupported(List<object> 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
Expand Down

0 comments on commit 5dbaef7

Please sign in to comment.