Version: 2022.2
언어: 한국어
Removed

XRDevice.isPresent

매뉴얼로 전환
Obsolete public static bool isPresent ;

설명

Successfully detected a XR device in working order.

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.

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());
    }
}