AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
CanvasHelper.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;
6 
7 namespace HoloToolkit.Unity
8 {
12  [RequireComponent(typeof(Canvas))]
13  public class CanvasHelper : MonoBehaviour
14  {
18  public Canvas Canvas;
19 
20  private void Awake()
21  {
22  if (Canvas == null)
23  {
24  Canvas = GetComponent<Canvas>();
25  }
26  }
27 
28  private void Start()
29  {
31  Debug.Assert(Canvas != null);
32 
33  if (Canvas.isRootCanvas && Canvas.renderMode == RenderMode.WorldSpace)
34  {
35  Canvas.worldCamera = FocusManager.Instance.UIRaycastCamera;
36  }
37  }
38  }
39 }
Canvas Canvas
The canvas this helper script is targeting.
Definition: CanvasHelper.cs:18
static void AssertIsInitialized()
Definition: Singleton.cs:49
static T Instance
Returns the Singleton instance of the classes type. If no instance is found, then we search for an in...
Definition: Singleton.cs:26
Helper class for setting up canvases for use in the MRTK.
Definition: CanvasHelper.cs:13
Focus manager is the bridge that handles different types of pointing sources like gaze cursor or poin...
Definition: FocusManager.cs:16