ランタイムにゲームオブジェクトが動かない場合、それは 静的 (static) ゲームオブジェクト と呼ばれます。ランタイムにゲームオブジェクトが動く場合、それは 動的 (dynamic) ゲームオブジェクト と呼ばれます。
Unity の多くのシステムでは、 静的ゲームオブジェクトに関する情報をエディターで事前計算できます。ゲームオブジェクトは移動しないため、これらの計算結果はランタイムでも有効です。つまり、Unity はランタイムの計算を節約し、パフォーマンスを向上させることができます。
Static エディターフラグ プロパティは多くの Unity のシステムを備え、事前計算に静的ゲームオブジェクトを加えることができます。ドロップダウンを使用して、事前計算にゲームオブジェクトを加えるシステムを決定します。ランタイムに Static エディターフラグを設定しても、これらのシステムには影響しません。
システムがゲームオブジェクトについて知る必要がある場合にのみ、事前計算にオブジェクトを含む必要があります。システムが知る必要のないゲームオブジェクトを事前計算に含めると、計算が無駄になったり、 データファイルが不必要に大きくなったり、予期しない動作が発生することがあります。
Static エディターフラグ プロパティは、ゲームオブジェクトのインスペクターの右上にあります。Everything か Nothing に値を設定するチェックボックス、その他の値を選べるドロップダウンで構成されます。
GameObjectUtility.SetStaticEditorFlags API と GameObject.isStatic を使って、Static エディターフラグプロパティをコードで設定することができます。
以下の値が選択可能です。
プロパティ | 機能 |
---|---|
Nothing | システムの事前計算にゲームオブジェクトを加えません。 |
Everything | 以下のすべてのシステムの事前計算にゲームオブジェクトを加えます。 |
Contribute GI | このプロパティを有効にすると、Unity はターゲットの メッシュレンダラー をグローバルイルミネーションの計算に加えます。これらの計算は、ベイク時にライティングデータを事前計算しながら行われます。ContributeGI プロパティは、ReceiveGI プロパティをアクセス可能にします。Baked Global Illumination やRealtime Global Illumination などのグローバルイルミネーション設定を適応するシーンで有効にしている場合のみ、ContributeGI プロパティが有効になります。ライトプローブを使用した静的ライティングに関する Unity ブログ に、このフラグを使用するための説明が記載されています。さらに、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. |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.