Version: 2022.3
言語: 日本語
public int GetTilesBlockNonAlloc (BoundsInt bounds, TileBase[] tiles);

パラメーター

bounds The bounds to retrieve from.
tiles The array of Tiles to contain the Tiles at the given bounds.

戻り値

int Returns the number of Tiles retrieved, including null entries.

説明

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. If the size of the arrays passed in as parameters are less than the number of Tiles within the range, the arrays will not be resized and the results will be limited.

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