public IEnumerator StartTeleport(RaycastResult hitResult, Vector3 position, Quaternion rotation, float delay)
        {
            if (delay > 0)
            {
                yield return(new WaitForSeconds(delay));
            }

            yield return(new WaitForEndOfFrame()); // to avoid from rendering guideline in wrong position

            TeleportTarget(position, rotation);

            if (OnAfterAnyTeleport != null)
            {
                OnAfterAnyTeleport.Invoke(this, hitResult, delay);
            }
            if (onAfterTeleport != null)
            {
                onAfterTeleport.Invoke(this, hitResult, delay);
            }

            if (delay > 0)
            {
                yield return(new WaitForSeconds(delay));
            }

            teleportCoroutine = null;
        }
        public IEnumerator StartTeleport(RaycastResult hitResult, Vector3 position, Quaternion rotation, float delay)
        {
            if (useSteamVRFade && VRModule.activeModule == VRModuleActiveEnum.SteamVR && !Mathf.Approximately(delay, 0f))
            {
                if (!m_steamVRFadeInitialized)
                {
                    // add SteamVR_Fade to the last rendered stereo camera
                    var fadeScripts = FindObjectsOfType <SteamVR_Fade>();
                    if (fadeScripts == null || fadeScripts.Length <= 0)
                    {
                        var topCam = SteamVR_Render.Top();
                        if (topCam != null)
                        {
                            topCam.gameObject.AddComponent <SteamVR_Fade>();
                        }
                    }

                    m_steamVRFadeInitialized = true;
                }

                m_isSteamVRFading = true;
                SteamVR_Fade.Start(new Color(0f, 0f, 0f, 1f), delay);

                yield return(new WaitForSeconds(delay));

                yield return(new WaitForEndOfFrame()); // to avoid from rendering guideline in wrong position

                TeleportTarget(position, rotation);

                if (OnAfterAnyTeleport != null)
                {
                    OnAfterAnyTeleport.Invoke(this, hitResult, delay);
                }
                if (onAfterTeleport != null)
                {
                    onAfterTeleport.Invoke(this, hitResult, delay);
                }

                SteamVR_Fade.Start(new Color(0f, 0f, 0f, 0f), delay);

                yield return(new WaitForSeconds(delay));

                m_isSteamVRFading = false;
            }
            else
            {
                if (delay > 0)
                {
                    yield return(new WaitForSeconds(delay));
                }

                yield return(new WaitForEndOfFrame()); // to avoid from rendering guideline in wrong position

                TeleportTarget(position, rotation);

                if (OnAfterAnyTeleport != null)
                {
                    OnAfterAnyTeleport.Invoke(this, hitResult, delay);
                }
                if (onAfterTeleport != null)
                {
                    onAfterTeleport.Invoke(this, hitResult, delay);
                }

                if (delay > 0)
                {
                    yield return(new WaitForSeconds(delay));
                }
            }

            teleportCoroutine = null;
        }