Skip to content

Commit

Permalink
Update CameraFOVChecker.cs to fix .NET build in Unity 2018 (#10654)
Browse files Browse the repository at this point in the history
Update CameraFOVChecker.cs
  • Loading branch information
keveleigh authored Jun 16, 2022
1 parent 6884b43 commit 1c31885
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Assets/MRTK/Core/Utilities/CameraFOVChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ public static class CameraFOVChecker
{
// Help to clear caches when new frame runs
private static int inFOVLastCalculatedFrame = -1;
#if !NETFX_CORE
// Map from grabbable => is the grabbable in FOV for this frame. Cleared every frame
private static Dictionary<ValueTuple<Collider, Camera>, bool> inFOVColliderCache = new Dictionary<ValueTuple<Collider, Camera>, bool>();
#else
private static Dictionary<Tuple<Collider, Camera>, bool> inFOVColliderCache = new Dictionary<Tuple<Collider, Camera>, bool>();
#endif
// List of corners shared across all sphere pointer query instances --
// used to store list of corners for a bounds. Shared and static
// to avoid allocating memory each frame
Expand All @@ -37,7 +41,12 @@ public static bool IsInFOVCached(this Camera cam, Collider myCollider)
return false;
}

#if !NETFX_CORE
ValueTuple<Collider, Camera> cameraColliderPair = ValueTuple.Create(myCollider, cam);
#else
Tuple<Collider, Camera> cameraColliderPair = Tuple.Create(myCollider, cam);
#endif

bool result;
if (inFOVLastCalculatedFrame != Time.frameCount)
{
Expand Down

0 comments on commit 1c31885

Please sign in to comment.