这个函数是照着看到的一篇博客上改的,一模一样的代码它的没有报错,而我的却报错了,显示它的返回值是一个布尔类型的值
var devices = UnityEditorInternal.VR.VREditor.GetVREnabledOnTargetGroup(BuildTargetGroup.Standalone);
var hasOpenVR = false;
foreach (var device in devices)
if (device.ToLower() == "openvr")
hasOpenVR = true;
if (!hasOpenVR)
{
string[] newDevices;
if (updated)
{
newDevices = new string[] { "OpenVR" };
}
else
{
newDevices = new string[devices.Length + 1];
for (int i = 0; i < devices.Length; i++)
newDevices[i] = devices[i];
newDevices[devices.Length] = "OpenVR";
updated = true;