qcx1216611038
2021-12-30 23:25
采纳率: 0%
浏览 169

UnityEditorInternal.VR.VREditor.GetVREnabledOnTargetGroup

这个函数是照着看到的一篇博客上改的,一模一样的代码它的没有报错,而我的却报错了,显示它的返回值是一个布尔类型的值


            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;

1条回答 默认 最新

相关推荐 更多相似问题