public TileBase[] GetTilesBlock (BoundsInt bounds);

Parámetros

boundsBounds to retrieve from.

Valor de retorno

TileBase[] An array of Tiles at the given bounds.

Descripción

Retrieves an array of tiles with the given bounds.

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

// Retrieves all tiles from an area on the tilemap and prints out the tiles to console
using UnityEngine;
using UnityEngine.Tilemaps;

public class ExampleClass : MonoBehaviour { public BoundsInt area;

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