Version: 2022.3
言語: 日本語
UnitySubsystemsManifest.json
XR SDK 入力サブシステム

サブシステムのランタイム検索とアクティベーション

Display0id で Display サブシステムをスキャンして作成または起動するために、以下のスクリプトをプロジェクトに追加します。他の Display サブシステムをロードしたい場合は、match の変数を変更します。

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.XR;
using UnityEngine.XR;

public class Display : MonoBehaviour
{
    public string match = "Display0";

    // 初期化には以下を使用します
    void Start ()
    {
        List<XRDisplaySubsystemDescriptor> displays = new List<XRDisplaySubsystemDescriptor>();
        SubsystemManager.GetSubsystemDescriptors(displays);
        Debug.Log("Number of display providers found: " + displays.Count);

        foreach (var d in displays)
        {
            Debug.Log("Scanning display id: " + d.id);

            if (d.id.Contains(match))
            {
                Debug.Log("Creating display " + d.id);
                XRDisplaySubsystem dispInst = d.Create();

                if (dispInst != null)
                {
                    Debug.Log("Starting display " + d.id);
                    dispInst.Start();
                }
            }
        }
    }
}

The XR Management package is the user-facing UI used to configure loading of subsystems at runtime. It uses the same underlying APIs (described above) to create and manage subsystems. If you want your provider to show up in the XR Settings UI, write an XRLoader.

プラグインの読み込みに失敗する場合は、後述のト ラブルシューティング を参照してください。

ランタイムのプラグイン検出のトラブルシューティング

サブシステムのプロバイダーの初期化や起動をトラブルシュートするには、エディターログ、またはプレイヤー出力ログXR または Subsystems で始まる行を確認してください。

C# でサブシステムが見つかりませんでした

If you just added a .json and plug-in files, make sure you relaunch Unity. Currently, Unity only discovers these files at start-up. Also, make sure that the Provider uses the correct file layout.

UnitySubsystemsManifest.json ファイルの検索と解析時のエラー

エラー 説明 
[XR] 3 ‘displays’ descriptors matched in Assets/UnityXRDisplayExample/UnitySubsystemsManifest.json Unity はディスプレイディスクリプターの検出に成功し、このプラグインに 3 つの異なる id を登録しています。
[XR] No descriptors matched for inputs in Assets/UnityXRDisplayExample/UnitySubsystemsManifest.json. The .json file contains no input descriptors. This is normal if you’re not implementing an input subsystem.
If you were expecting Unity to find descriptors in your .json file, they could be malformed. See documentation on UnitySubsystemsManifest.json for the correct format to use.
[XR] Failed to parse json header for Assets/UnityXRDisplayExample/UnitySubsystemsManifest.json (did you forget to include name or libraryName fields?) これは、不正な .json ファイルがあることを意味すると考えられます。json linter のような検証ツールで確認してください。

プロバイダープラグインの検索とロードに関するエラー

エラー 説明 
[XR] PluginName failed to register Provider for DisplayId (json name or id doesn’t match?) これは、RegisterLifecycleProvider の最初の 2 つの引数が、.json ファイルと一致していないことを意味します。
最初の引数である pluginName は、.json ファイルの name フィールドと一致する必要があります。
2 番目の引数である id は、.json ファイルのサブシステムの id フィールドと一致する必要があります。
[XR] Unable to load plugin PluginName for subsystem DisplayId プラグインが見つかりませんでした。誤ったアーキテクチャ用にビルドされているか、ロードする必要のある依存関係が不足しています。後者の場合は、Dependency Walker ツールを使用して、不足している依存関係があるかどうかを調べることができます。

プロバイダーの初期化に関するエラー

エラー 説明 
[XR] Failed to initialize subsystem DisplayId [error: 1] Unity は Initialize メソッドを呼び出しましたが、kUnitySubsystemErrorCodeFailure が返されました。Initialize メソッドの実装を再確認してください。
UnitySubsystemsManifest.json
XR SDK 入力サブシステム