0 votes
by (250 points)

开发者您好,我想在Pico Neo 3 Unity VR 游戏中使用一个系统选单的快捷键,参考官方demo goto-system-setting-UnityXR 这个项目的使用方法 script 來打開 Pico 的系統選單
https://github.com/picoxr/goto-system-setting-UnityXR/blob/main/Assets/StartAction.cs#L29

但在游戏中一执行此 startToAction 函式会造成画面分割在萤幕的最左边跟最右边(抱歉截图看不出来) 且手把在此状态无法操作,不知道有什么解决办法? 但按 Home 鍵在按 continue 後就正常了

p.s. SDK 为最新版本

1 Answer

+1 vote
by (55.5k points)

开发者您好,您可以尝试将StartAction.cs脚本中的代码修改为以下代码:

private void startToAction(string action)
    {

    /*  AndroidJavaClass jcPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject joActivity = jcPlayer.GetStatic<AndroidJavaObject>("currentActivity");
        AndroidJavaObject joIntent = new AndroidJavaObject("android.content.Intent", action);
        joActivity.Call("startActivity", joIntent);
    */

        AndroidJavaObject context = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
        AndroidJavaObject intent = new AndroidJavaObject("android.content.Intent", "pvr.intent.action.ADAPTER");
        AndroidJavaObject intentEx = new AndroidJavaObject("android.content.Intent", action);
        intent.Call<AndroidJavaObject>("putExtra", "intent", intentEx);
        intent.Call<AndroidJavaObject>("setPackage", "com.pvr.adapter");
        context.Call<AndroidJavaObject>("startService", intent);
    }
by (250 points)

謝謝 解決了 : )

...