Skip to content

Commit

Permalink
Fix compile errors in 2020.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mtschoen-unity committed Aug 20, 2020
1 parent 8508727 commit b64c73b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Runtime/Scripts/Core/VRView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,11 @@ void DoDrawCamera(Rect rect)
if (Event.current.type == EventType.Repaint)
{
#pragma warning disable 618
#if !UNITY_2020_2_OR_NEWER
if (XRDevice.isPresent)
UnityEditor.Handles.DrawCamera(rect, m_Camera, m_RenderMode);
else
#endif
m_Camera.Render();
#pragma warning restore 618

Expand Down Expand Up @@ -506,9 +508,13 @@ void UpdateHMDStatus()

internal static bool GetIsUserPresent()
{
#if UNITY_2020_2_OR_NEWER
return false;
#else
#pragma warning disable 618
return XRDevice.userPresence == UserPresenceState.Present;
#pragma warning restore 618
#endif
}

void SetGameViewsAutoRepaint(bool enabled)
Expand Down Expand Up @@ -544,5 +550,5 @@ void SetAutoRepaintOnSceneChanged(Type viewType, bool enabled)
}
}
#endif
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ static class UsesDeviceTypeMethods
/// <returns>The device type</returns>
public static DeviceType GetDeviceType(this IUsesDeviceType @this)
{
#if UNITY_2020_2_OR_NEWER
return default;
#else
#pragma warning disable 618
if (string.IsNullOrEmpty(s_XRDeviceModel))
s_XRDeviceModel = XRDevice.model;
#pragma warning restore 618

return s_XRDeviceModel.IndexOf("oculus", StringComparison.OrdinalIgnoreCase) >= 0
? DeviceType.Oculus : DeviceType.Vive;
#endif
}
}
}
2 changes: 2 additions & 0 deletions Runtime/Scripts/Proxies/Vive/ViveProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ sealed class ViveProxy : TwoHandedProxyBase

protected override void Awake()
{
#if !UNITY_2020_2_OR_NEWER
#pragma warning disable 618
m_IsOculus = XRDevice.model.IndexOf("oculus", StringComparison.OrdinalIgnoreCase) >= 0;
#pragma warning restore 618
#endif

if (m_IsOculus)
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/libs/input-prototype

0 comments on commit b64c73b

Please sign in to comment.