Version: 2017.2
public static void LoadDeviceByName (string deviceName);
public static void LoadDeviceByName (string[] prioritizedDeviceNameList);

パラメーター

deviceName Name of the device from XRSettings.supportedDevices.
prioritizedDeviceNameList Prioritized list of device names from XRSettings.supportedDevices.

説明

次のフレームの最初にリクエストされた端末を読み込みます。

A list of supported devices which can be passed into this function can be obtained from XRSettings.supportedDevices.

In order to check for success, check XRSettings.loadedDeviceName on the next frame.

This function will try to initialize only the device(s) passed in, it will not fall back to other devices in the XRSettings.supportedDevices list. You can pass a list of values to fall back to other devices on failure. If no device could be initialized, it will fall back to XRSettings.loadedDeviceName as an empty string and set XRSettings.enabled to false.

You can disable XR by loading an empty string deviceName.

After loading a device, you may want to enable it with XRSettings.enabled.

// Run in split-screen mode

using System.Collections; using UnityEngine; using UnityEngine.XR;

public class ExampleClass : MonoBehaviour { void Start() { StartCoroutine(LoadDevice("Split")); }

IEnumerator LoadDevice(string newDevice) { XRSettings.LoadDeviceByName(newDevice); yield return null; XRSettings.enabled = true; } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961