Tilemap Renderer コンポーネントはシーンの タイルマップ をレンダリングします。Unity は、デフォルトで Tilemap Renderer (タイルマップレンダラー) がアタッチされた Tilemap を作成します。タイルマップレンダラーでは以下のことが可能です。
レンダーモードは、レンダリング時にタイルマップスプライトをソートする方法に影響します。
Chunk モードは Tilemap Renderer のデフォルトレンダリングモードです。
Chunk モードに設定すると、Tilemap Renderer はタイルマップのスプライトをまとめて処理し、レンダリングします。それらは、2D Transparent Queue でソートされる場合、1 つのソートアイテムとして扱われます。これにより、ドローコールの回数が減り全体的なパフォーマンスが向上します。ただし、他のレンダラーはタイルマップのどの部分にもレンダリングできないため、他のレンダリングされたスプライトをタイルマップスプライトと混合することはできません。
Chunk Mode では、タイルマップレンダラーは複数のテクスチャから個別にタイルをソートすることができず、タイルスプライトのレンダリングに矛盾が発生することがあります (下の例 を参照)。
この問題を解決するには、タイルマップを構成するすべての個々のスプライトを 1 つの スプライトアトラス にまとめます。これを行うには、以下の通りです。
Assets メニューから スプライトアトラス を作成します (Asset > Create > Sprite Atlas)。
スプライトをスプライトアトラスに追加するには、アトラスの Inspector ウィンドウの Objects for Packing リストにドラッグします。
Pack Preview をクリックします。 Unity は、再生モードの間にスプライトをスプライトアトラスにまとめ、正しくソートしレンダリングします。これは、再生モードのエディターでのみ表示されます。
Individual Mode では、タイルマップレンダラーは、スプライトレンダラー や メッシュレンダラー など、シーン内の他のレンダラーを考慮して、タイルマップのスプライトをソートしレンダリングします。他のレンダラーがタイルマップ上のスプライトとオブジェクトと相互作用する場合は、このモードを使用します。
このモードでは、タイルマップレンダラーは、タイルマップ上の位置と設定されたソートプロパティに基づいてスプライトをソートします。例えば、このモードで、キャラクタースプライトを障害物スプライトの間に位置することができます (下の例を参照)。
同じ例を Chunk モードを使用すると、キャラクターのスプライトが地面のスプライトの裏に隠れることがあります。
各スプライトを個別にタイルマップにレンダリングする際に Idividual モードを使用すると、オーバーヘッドが増えるためパフォーマンスが低下する場合があります。
Isometric Z as Y タイルマップでタイルスプライトを正しくソートしレンダリングするには、Transparency Sort Axis を Custom Axis に設定する必要があります。最初に Renderer Mode を Individual モードに設定し、Edit > Settings > Graphics に移動します。
Transparency Sort Mode を Custom Axis に設定し、Y 値を –0.26 に設定します。Transparency Sort Axis 設定の詳細は、アイソメトリックタイルマップの作成 を参照してください。
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.