Version: 2020.1
言語: 日本語
タイルマップの作成
タイルパレットの作成

タイルの作成

タイル アセットを作成するには 2 つ方法があります。最初の方法は、Assets メニューから直接タイルアセットを作成する方法です。もう 1 つは選択したスプライトから自動的にタイルアセットを作成する方法です。

タイルアセット用のスプライトの読み込みと準備

タイルマップ用の個々のタイルやタイルセット画像を Assets フォルダーに置くことによって、それらのテクスチャを Assets フォルダーに インポート します。インポートした画像を選択すると、テクスチャインポーター 設定が Inspector ウィンドウに表示されます。

Sprite Importer settings.
Sprite Importer settings.

タイルマップで使用するためのスプライトをインポートするときは、以下の推奨する設定を使用してください。各設定の詳細は、Texture Type: Sprite (2D and UI) を参照してください。

  1. Texture Type - Set this to Sprite (2D and UI). Other Texture types are not supported for Tilemaps.
  2. Sprite Mode - Set this to Single if the Texture contains only a single Sprite. Set to Multiple if it contains multiple elements, for example a Tile sheet that contains multiple Tile Textures. Set Sprite Mode to Multiple when importing a Sprite sheet.
  3. Pixels Per Unit (PPU) - This value is the number of pixels that make up one Unity unit for the selected Sprite. This determines the size of the Tile Sprite when it is rendered on the Tilemap. It is recommended to set this value to the width(in pixels) of a single Tile Sprite so that a Tile is equal to one Unity unit in width. For both Hexagonal and Isometric Tiles, measure the width of the Sprites at their widest. The size of the Tile Sprites are also affected by the Cell Size property of the Grid parent of the Tilemap also affects the size of Tile Sprites as the Cell Size determines how many Unity units equal to a single Cell.

    In the example below, the imported Sprites are 64x64. The default Tilemap has a Cell Size of (XYZ: 1, 1, 0) Unity units. To make a Tile Sprite fit exactly on a single Cell of the Tilemap, set its PPU value to 64 to match its pixel width. The Sprite’s entire width then corresponds to one Unity unit, which is equal to the width (X value: 1) of a single Cell on the Tilemap. Left: Sprites set to 64 PPU. Middle: Same Sprites set to 128 PPU. Right: Sprites set to 32 PPU.
    By doubling the original PPU value of 64 to 128, the Sprite scales to 0.5(64px/128) Unity units in width. Halving the PPU value to 32 instead scales the Sprites to 2(64px/32) Unity units in width. The Sprites appear smaller or bigger respectively, however their Cell position on the Tilemap remains unchanged.
  4. Sprite Editor Outlines - After the Sprites are imported, refine the outlines of the Sprites by opening each of them in the Sprite Editor and editing their outlines. If the Texture is imported with Sprite Mode set to Multiple and contains multiple Sprites, then edit the outline of each of the Sprites in the editor.

Create a blank Tile Asset from the Asset menu

Create a Tile directly from the Assets menu by going to Assets > Create > Tile. You will be prompted to name and save the new blank Tile Asset to your chosen location. Refer to the documentation on Tile Assets for more information about the Asset properties.

Creating a new Tile Asset.
Creating a new Tile Asset.

Generate Tile Assets automatically in the Tile Palette

Tiles can be automatically generated by bringing the individual Sprites or Sprite sheets of the Tiles directly into the Tile Palette window (if the window is not open, go to Window > 2D > Tile Palette).

First prepare and import the Tile Sprites, then open the ‘New Palette’ drop-down menu in the Tile Palette window. Select an existing Tile Palette from the list, or select ‘Create New Palette’ to open the Create New Palette dialog box.

The New Palette drop-down menu.
The New Palette drop-down menu.

After selecting the properties of the Tile Palette (refer to the Tile Palettes documentation for more information about the different options), select Create to open the new Palette in the window.

Select Create to create a new Tile Palette.
Select ‘Create’ to create a new Tile Palette.

After creating or loading a Palette, drag and drop Textures or Sprites from the Assets folder directly onto the Tile Palette window. You will be prompted for the save location for the new Tile Assets. Select the save location, and the new Tile Assets are generated in the selected folder. The generated Tiles are also automatically placed onto the Palette.

Tile Asset credit to Kenney
Tile Asset credit to Kenney

  • 2020.1 にページコンテンツとスクリーンショットを更新NewIn20201
  • タイルマップは 2017.2 で追加NewIn20172
タイルマップの作成
タイルパレットの作成
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961