我可以将图片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;
}
}
我的图片是立方体贴图设置。