Version: 2023.2
言語: 日本語
タグ
保存

静的ゲームオブジェクト

ランタイムにゲームオブジェクトが動かない場合、それは 静的 (static) ゲームオブジェクト と呼ばれます。ランタイムにゲームオブジェクトが動く場合、それは 動的 (dynamic) ゲームオブジェクト と呼ばれます。

Unity の多くのシステムでは、 静的ゲームオブジェクトに関する情報をエディターで事前計算できます。ゲームオブジェクトは移動しないため、これらの計算結果はランタイムでも有効です。つまり、Unity はランタイムの計算を節約し、パフォーマンスを向上させることができます。

静的エディターフラグプロパティ

ゲームオブジェクトのインスペクターに表示された静的エディターフラグのチェックボックスとドロップダウンメニュー
ゲームオブジェクトのインスペクターに表示された静的エディターフラグのチェックボックスとドロップダウンメニュー

静的エディターフラグ プロパティは、事前計算に静的ゲームオブジェクトを加えることができる多くの Unity のシステムを列挙しています。ドロップダウンを使用して、事前計算にゲームオブジェクトを含めるシステムを決定します。ランタイムに静的エディターフラグを設定しても、これらのシステムには影響しません。

システムがゲームオブジェクトについて知る必要がある場合にのみ、事前計算にオブジェクトを含む必要があります。システムが知る必要のないゲームオブジェクトを事前計算に含めると、計算が無駄になったり、 データファイルが不必要に大きくなったり、予期しない動作が発生することがあります。

静的エディターフラグ プロパティは、ゲームオブジェクトのインスペクターの右上にあります。これは、静的 に設定するチェックボックスと、EverythingNothing、その他の値を選べるドロップダウンで構成されます。

GameObjectUtility.SetStaticEditorFlags API と GameObject.isStatic を使って、静的エディターフラグプロパティをコードで設定することができます。

以下の値が選択可能です。

プロパティ 機能
Nothing システムの事前計算にゲームオブジェクトを加えません。
Everything 以下のすべてのシステムの事前計算にゲームオブジェクトを加えます。
Contribute GI When you enable this property, Unity includes the target Mesh Renderer in global illumination calculations. These calculations take place while precomputing lighting data at bake time. The ContributeGI property exposes the ReceiveGI property. The ContributeGI property only takes effect if you enable a global illumination setting such as Baked Global Illumination or Enlighten Realtime Global Illumination for the target Scene. A Unity Blog post about static lighting with Light Probes provides guidance for using this flag. For additional context, see this tutorial for setting up the Built-in Render Pipeline and lighting in Unity.
Occluder Static Mark the GameObject as a Static Occluder in the occlusion culling system. For more information, refer to the Occlusion Culling system.
Occludee Static Mark the GameObject as a Static Occludee in the occlusion culling system. For more information, refer to the Occlusion Culling system.
Batching Static Combine the GameObject’s Mesh with other eligible Meshes, to potentially reduce runtime rendering costs. For more information, refer to the documentation on Static Batching.
Navigation Static Include the GameObject when precomputing navigation data. For more information, refer to the Navigation system.
Off Mesh Link Generation Attempt to generate an OffMesh Link that starts from this GameObject when precomputing navigation data. For more information, refer to the documentation for automatically building OffMesh Links.
Reflection Probe Include this GameObject when precomputing data for Reflection Probes whose Type property is set to Baked. For more information, refer to Reflection Probes.
タグ
保存