Version: 2022.1
言語: 日本語
ランタイム UI について
Panel Settings プロパティのリファレンス

ゲームビューで UI をレンダリングする

To render UI and react to input from the users in the Game view, connect the UI Document assets to a Panel Settings asset by a UI Document component.

Every UI Document component references a UI Document asset (.uxml file) that defines the UI and a Panel Settings asset that renders it. You can connect more than one UI Document asset to a single Panel Settings asset.

Configure

Panel Settings アセットは、シーン内のパネルを定義します。パネルは、UI 階層がアタッチされるルートビジュアル要素を提供し、ランタイムにシーンに UI を描画します。Panel Settings アセットをどのように設定するかによって、UI がどのようにレンダリングされるかが決まります。また、入力に対する UI の反応も決まります。例えば、視覚的に手前にあるパネルは、視覚的に奥にあるパネルよりも先にユーザーからのクリックをインターセプトします。

Panel Settings アセットを設定して、以下を行えます。

  • スケールと解像度を制御する
  • デフォルトのスタイルを適用する
  • レンダーテクスチャに UI を表示する
  • パネルのソート順を設定する

パネルを設定するには以下を行います。

  1. In your project, select Assets > Create > UI Toolkit > Panel Settings Asset to create a Panel Settings asset if you don’t have it.
  2. In the Inspector window of the Panel Settings, configure the Panel Settings properties.

UI をパネルに接続する

A panel can display UI from more than one UI Document asset. Each UI Document has a Sort Order property that sets the UI Document rendering order:

  • 子 UI Document コンポーネントは、親 UI Document コンポーネントの上に描画されます。
  • 同じ階層にある UI Documents コンポーネントは、Sort Order に基づいて順番にレンダリングされます。

To connect more than one UI Document asset to a panel:

  1. UI をホストするゲームオブジェクトを選択または作成します。

  2. Component > UI Toolkit > UI Document を選択して、UI Documentコンポーネントを加えます。

  3. UIDocument の Inspector ウィンドウで、以下を行います。

    • Set the Panel Settings to the Panel Settings asset to display the UI.
    • Set the Source Asset to the UI Document (.uxml file) asset that contains the UI you want to display.
    • set the Sort Order. UI Document with a smaller number rendered first.
  4. Repeat the process for each UI Document asset.

Note: If there are multiple UI documents attached to the same Panel Settings asset, all these documents have a common focus navigation context. If they have distinct Panel Settings, navigation won’t jump automatically from one to the other even if they’re arranged side by side.

その他の参考資料

ランタイム UI について
Panel Settings プロパティのリファレンス