AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
CameraCache.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using UnityEngine;
5 
6 namespace HoloToolkit.Unity
7 {
12  public static class CameraCache
13  {
14  private static Camera cachedCamera;
15 
19  public static Camera Main
20  {
21  get
22  {
23  if (cachedCamera == null)
24  {
25  return Refresh(Camera.main);
26  }
27  return cachedCamera;
28  }
29  }
30 
35  public static Camera Refresh(Camera newMain)
36  {
37  return cachedCamera = newMain;
38  }
39  }
40 }
static Camera Refresh(Camera newMain)
Set the cached camera to a new reference and return it
Definition: CameraCache.cs:35
The purpose of this class is to provide a cached reference to the main camera. Calling Camera...
Definition: CameraCache.cs:12