Version: 2020.3
언어: 한국어
public void SetTilesBlock (BoundsInt position, TileBase[] tileArray);

파라미터

position Bounds to be filled.
tileArray An array of Tiles to be placed.

설명

Fills bounds with array of tiles.

This is meant for a more performant way to set tiles as a batch, when compared to calling SetTile for every single tile. The bounds size must match the array size. For example bounds of 1x2x3 needs an array length of 6.

// Fill area on tilemap with checkerboard pattern of tileA and tileB
using UnityEngine;
using UnityEngine.Tilemaps;

public class ExampleClass : MonoBehaviour { public TileBase tileA; public TileBase tileB; public BoundsInt area;

void Start() { TileBase[] tileArray = new TileBase[area.size.x * area.size.y * area.size.z]; for (int index = 0; index < tileArray.Length; index++) { tileArray[index] = index % 2 == 0 ? tileA : tileB; } Tilemap tilemap = GetComponent<Tilemap>(); tilemap.SetTilesBlock(area, tileArray); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961