Version: 2021.3
언어: 한국어

Tilemap.GetTilesRangeNonAlloc

매뉴얼로 전환
public int GetTilesRangeNonAlloc (Vector3Int startPosition, Vector3Int endPosition, Vector3Int[] positions, TileBase[] tiles);

파라미터

startPosition The starting position of the range to retrieve Tiles from.
endPosition The ending position of the range to retrieve Tiles from.
positions The positions of Tiles within the given range.
tiles The Tiles within the given range.

반환

int Returns the number of positions and Tiles retrieved.

설명

Retrieves an array of Tiles within the given range.

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 with a range on the tilemap and prints out the positions and tiles to console
using UnityEngine;
using UnityEngine.Tilemaps;

public class ExampleClass : MonoBehaviour { void Start() { Vector3Int[] positions = new Vector3Int[11]; TileBase[] tiles = new TileBase[11]; Tilemap tilemap = GetComponent<Tilemap>(); var count = tilemap.GetTilesRangeNonAlloc(new Vector3Int(0, 0, 0), new Vector3Int(10, 0, 0), positions, tiles); for (int index = 0; index < count; index++) { print(positions[index]); print(tiles[index]); } } }