gpt4 book ai didi

c# - 如何在虚拟现实 (GearVR) 应用程序中打开 URL

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:11:10 25 4
gpt4 key购买 nike

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

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

应用卡住。

如果这根本不可能,那么有没有办法在 3D 空间中显示棘手的 Web View ?

我们将不胜感激任何形式的帮助。

最佳答案

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

这是工作代码:

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
}

It will wait until the user has removed the headset before opening the app to avoid the jarring visuals of the app freezing when you try to open the URL. If the player takes the headset off and puts it back on they will be returned to where they were in the game.


希望这对迟到的用户有帮助:)

礼貌:Glitchers Games

关于c# - 如何在虚拟现实 (GearVR) 应用程序中打开 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39747977/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com