Tilemap (タイルマップ) コンポーネントは 2D のレベルを作成するための タイルアセット を格納し処理するシステムです。Tilemap コンポーネントは、そこに保存されたタイルの必要な情報を、Tilemap Renderer や Tilemap Collider 2D などの他の関連コンポーネントに転送します。
Unity エディターのインストールには含まれていないため、Package Manager から 2D Tilemap Editor パッケージをダウンロードしてください。
このコンポーネントを Grid (グリッド) コンポーネント、または親 Grid ゲームオブジェクトとともに使用して、関連するグリッド上にタイルをレイアウトします。タイルマップを作成 (GameObject > 2D Object > Tilemap) すると、Unity は自動的に Grid ゲームオブジェクトを作成し、それを子の Tilemap ゲームオブジェクトの親に設定します。
タイルマップのタイルを変更して配置するには、Tile Palette (タイルパレット) (Window > 2D > Tile Palette) を開きます。詳細は、タイルパレットと タイルマップのペイント に関するドキュメントを参照してください。
プロパティ | 機能 |
---|---|
Animation Frame Rate | Unity がタイルアニメーションを再生するレート。これを増減すると、速度が該当する係数に応じて変更されます (例えば、これを 2 に設定すると、Unity は 2 倍の速度でタイルアニメーションを再生します)。 |
Color | このタイルマップのタイルに選択した色を適用します。白に設定すると、Unity はタイルに色をつけずに描画します。 |
Tile Anchor | タイルマップ上のタイルのアンカーオフセット。位置の値を調整して、関連付けられたグリッド上のタイルのセル位置をずらします。 |
Orientation | タイルマップのタイルの向き。特定の平面 (特に 3D ビュー) でタイルの向きを調整する必要がある場合に使用します。 |
XY | XY 平面上でタイルの向きを決定します。 |
XZ | XZ 平面上でタイルの向きを決定します。 |
YX | YX 平面上でタイルの向きを決定します。 |
YZ | YZ 平面上でタイルの向きを決定します。 |
ZX | ZX 平面上でタイルの向きを決定します。 |
ZY | ZY 平面上でタイルの向きを決定します。 |
Custom | 以下のパラメーターで設定されたカスタムの向きの行列の設定に基づいてタイルを配置します。このオプションを選択すると以下のパラメーターが編集可能になります。 |
Offset | 現在の向きの行列の位置オフセットを表示します。 このプロパティは、Tilemap の Orientation がカスタムに設定されている場合にのみ編集できます。 |
Rotation | 現在の向きの行列の回転オフセットを表示します。 このプロパティは、Tilemap の Orientation がカスタムに設定されている場合にのみ編集できます。 |
Scale | 現在の向きの行列のスケールオフセットを表示します。 このプロパティは、Tilemap の Orientation がカスタムに設定されている場合にのみ編集できます。 |
以下は、タイルマップ の作成とペイントの一般的なワークフローです。
Unity は、Hexagonal や Isometric タイルマップなど、特殊なタイプのタイルマップもサポートしています。具体的なワークフローについてはそれぞれのページのドキュメントを参照してください。
GitHub の 2D Extras から Tile と Brush のスクリプトをダウンロードできます。これらのプログラム記述されたゲームオブジェクトを使ったサンプルプロジェクトは 2D Techdemos の Github リポジトリにあります。さまざまなスクリプトと使用法の説明は、各リポジトリの README.md を参照してください。
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.