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]); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961