GetTileEntityIdsFromOffsets(Vector3Int, NativeArray<Vector3Int>, NativeArray<EntityId>)
Gets an array of EntityIds at an offset from the position and stores them into the given array of EntityIds in the same order.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine.Tilemaps
- Assembly: UnityEngine.TilemapModule
public void GetTileEntityIdsFromOffsets(Vector3Int position, NativeArray<Vector3Int> offsets, NativeArray<EntityId> tileEntityIds)
Parameters
Examples
using Unity.Collections;using UnityEngine;using UnityEngine.Tilemaps;public static class TilemapExample{ public static void GetTileEntityIdFromOffsetsExample(Tilemap tilemap, Vector3Int position, Tile tile) { int count = 5; NativeArray<Vector3Int> offsets = new NativeArray<Vector3Int>(count, Allocator.Temp); NativeArray<EntityId> entityIds = new NativeArray<EntityId>(count, Allocator.Temp); for (var i = 0; i < count; i++) { offsets[i] = new Vector3Int(i, 0, 0); tilemap.SetTile(position + offsets[i], tile); } tilemap.GetTileEntityIdsFromOffsets(position, offsets, entityIds); for (var i = 0; i < count; i++) { Debug.Log($"The ids for the Tile placed are equal ({(entityIds[i] == tile.GetEntityId()).ToString()})"); } }}