如何将VR独立屏幕切换为完整非独立屏幕?

时间:2018-07-20 07:16:37

标签: c# unity3d virtual-reality google-cardboard

我可以将图片2d到VR屏幕,但我想将VR屏幕(单独的屏幕)做到全屏,但是全屏必须跟随手机的旋转。我搜索了很多YouTube,视频,书籍,但找不到任何方法。因此,请教该怎么做。

这是我的代码

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.VR;

public class VRtoggle : MonoBehaviour {

    // Use this for initialization
    void Start () {

}

    // Update is called once per frame
    void Update () {
        if(Input.GetMouseButtonDown(0))
        {
            ToggleVR();
        }
    }

    void ToggleVR()
    {
        if(UnityEngine.XR.XRSettings.loadedDeviceName == "cardboard")
        {
            StartCoroutine(LoadDevice("None"));

        }
        else
        {
            StartCoroutine(LoadDevice("cardboard"));
        }
    }
    IEnumerator LoadDevice(string newDevice)
    {
        UnityEngine.XR.XRSettings.LoadDeviceByName(newDevice);
        yield return null;
        UnityEngine.XR.XRSettings.enabled = true;
    }
}

我的图片是立方体贴图设置。

0 个答案:

没有答案