ドキュメント

Unity Engine

Unity Engine

isPresent

Successfully detected a XR device in working order.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Property
  • Namespace: UnityEngine.XR
  • Assembly: UnityEngine.VRModule
注意
Removed. This is obsolete, and should no longer be used. Instead, find the active XRDisplaySubsystem and check that the running property is true (for details, see XRDevice.isPresent documentation).
public static bool isPresent { get; }

Remarks

This property is obsolete and will be removed in an upcoming release.
Instead, find the active XRDisplaySubsystem and check to see if it is running. The example illustrates this process.

Examples

using System;using System.Collections.Generic;using UnityEngine;using UnityEngine.XR;internal static class ExampleUtil{ public static bool isPresent() { var xrDisplaySubsystems = new List<XRDisplaySubsystem>(); SubsystemManager.GetInstances<XRDisplaySubsystem>(xrDisplaySubsystems); foreach (var xrDisplay in xrDisplaySubsystems) { if (xrDisplay.running) { return true; } } return false; }}public class CheckXRDisplay : MonoBehaviour{ void Awake() { Debug.Log("Do we have an Active Display? " + ExampleUtil.isPresent().ToString()); }}