AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
DisplayDependentObjectActivator.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 #if UNITY_WSA && UNITY_2017_2_OR_NEWER
7 using UnityEngine.XR.WSA;
8 #endif
9 
10 public class DisplayDependentObjectActivator : MonoBehaviour
11 {
12  [SerializeField]
13  protected bool OpaqueDisplay = true;
14 
15  [SerializeField]
16  protected bool TransparentDisplay = false;
17 
18  protected void Awake()
19  {
20 #if UNITY_WSA && UNITY_2017_2_OR_NEWER
21  if ((HolographicSettings.IsDisplayOpaque && !OpaqueDisplay) ||
22  (!HolographicSettings.IsDisplayOpaque && !TransparentDisplay))
23  {
24  gameObject.SetActive(false);
25  }
26 #endif
27  }
28 }