【问题标题】:How to open URL in Virtual Reality (GearVR) App如何在虚拟现实 (GearVR) 应用程序中打开 URL
【发布时间】:2016-09-28 12:45:40
【问题描述】:

我想知道如何在 Gear VR 应用程序中点击按钮打开 URL。 Oculus Store 中的Samsung Internet App 可以在这种情况下使用。就像在 2D Non-VR Android Application 中一样,URL 在 Chrome 或 Firefox 中基于默认浏览器自动打开。但是当我打电话时在 Gear VR 应用程序中

Application.OpenURL("http://www.google.co.uk");

应用程序冻结。

如果这根本不可能,那么有没有办法在 3D 空间中显示难以处理的 Web-View?

我们将不胜感激。

【问题讨论】:

    标签: c# android unity3d gear-vr


    【解决方案1】:

    我在 Oculus 论坛上的 this post 找到了解决方案。

    这是工作代码:

    public class OpenWebsiteOnHeadsetRemove : MonoBehaviour
    {
        #region Serialized
        public OVRManager m_OVRManager;
        #endregion
    
        #region Variables
        private bool m_UserPresent = true;
        private bool m_HasOpenedURL = false;
        #endregion
    
        #region Lifecycle
        private void Update () {
        #if UNITY_ANDROID
            bool isUserPresent = m_OVRManager.isUserPresent;
    
            if( m_UserPresent != isUserPresent )
            {
                if( isUserPresent == false && m_HasOpenedURL == false && Application.isEditor == false )
                {
                    m_HasOpenedURL = true;
                    Application.OpenURL("http://www.google.co.uk");
                }
            }
    
            m_UserPresent = isUserPresent;
        #endif
        }
        #endregion
    }
    

    它会等到用户取下耳机后再打开 应用程序,以避免在您尝试时应用程序冻结的不和谐视觉效果 打开网址。如果播放器取下耳机并重新戴上 他们将返回到他们在游戏中的位置。


    希望这对后期用户有所帮助:)

    礼貌:Glitchers Games

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多