/// <summary>
        /// Change the observed volume according to ObserverVolumeType.
        /// </summary>
        private void SwitchObservedVolume()
        {
#if UNITY_EDITOR || UNITY_WSA
            if (observer == null)
            {
                return;
            }

            switch (observerVolumeType)
            {
            case ObserverVolumeTypes.AxisAlignedBox:
                observer.SetVolumeAsAxisAlignedBox(origin, extents);
                break;

            case ObserverVolumeTypes.OrientedBox:
                observer.SetVolumeAsOrientedBox(origin, extents, orientation);
                break;

            case ObserverVolumeTypes.Sphere:
                observer.SetVolumeAsSphere(origin, extents.magnitude);     //workaround
                break;

            default:
                observer.SetVolumeAsAxisAlignedBox(origin, extents);
                break;
            }
#endif
        }
        /// <summary>
        /// Can be called to override the default origin for the observed volume.  Can only be called while observer has been started.
        /// </summary>
        public bool SetObserverOrigin(Vector3 origin)
        {
            bool originUpdated = false;

            if (observer != null)
            {
                observer.SetVolumeAsAxisAlignedBox(origin, Extents);
                originUpdated = true;
            }

            return(originUpdated);
        }
        /// <summary>
        /// Starts the Surface Observer.
        /// </summary>
        public void StartObserving()
        {
            if (observer == null)
            {
                observer = new UnityEngine.XR.WSA.SurfaceObserver();
                observer.SetVolumeAsAxisAlignedBox(Vector3.zero, Extents);
            }

            if (ObserverState != ObserverStates.Running)
            {
                Debug.Log("Starting the observer.");
                ObserverState = ObserverStates.Running;

                // We want the first update immediately.
                updateTime = 0;
            }
        }