# SetTiles

> Sets an array of Tile s at the given XYZ coordinates of the corresponding cells in the Tilemap.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Tilemaps](/engine/6000.0/script-reference/unityengine/tilemaps.md)
* **Assembly:** UnityEngine.TilemapModule

## SetTiles(Vector3Int\[], TileBase\[])

Sets an array of [Tile](/engine/6000.0/script-reference/unityengine/wsa/tile.md)s at the given XYZ coordinates of the corresponding cells in the [Tilemap](/engine/6000.0/script-reference/unityengine/tilemaps/tilemap.md).

```csharp
public void SetTiles(Vector3Int[] positionArray, TileBase[] tileArray)
```

### Parameters

**** (\[Vector3Int\[]]\(/engine/6000.0/script-reference/unityengine/vector3int)): An array of positions of Tiles on the [Tilemap](/engine/6000.0/script-reference/unityengine/tilemaps/tilemap.md).**** (\[TileBase\[]]\(/engine/6000.0/script-reference/unityengine/tilemaps/tilebase)): An array of [Tile](/engine/6000.0/script-reference/unityengine/wsa/tile.md)s to be placed.

### Remarks

Refer to Scriptable Tiles and Tilemap for more information.

### Examples

```csharp
// Fills Tilemap area with checkerboard pattern of tileA and tileB
using UnityEngine;
using UnityEngine.Tilemaps;

public class ExampleClass : MonoBehaviour
{
    public TileBase tileA;
    public TileBase tileB;
    public Vector2Int size;

    void Start()
    {
        Vector3Int[] positions = new Vector3Int[size.x * size.y];
        TileBase[] tileArray = new TileBase[positions.Length];

        for (int index = 0; index < positions.Length; index++)
        {
            positions[index] = new Vector3Int(index % size.x, index / size.y, 0);
            tileArray[index] = index % 2 == 0 ? tileA : tileB;
        }

        Tilemap tilemap = GetComponent<Tilemap>();
        tilemap.SetTiles(positions, tileArray);
    }
}
```

## SetTiles(TileChangeData\[], bool)

Sets an array of [Tile](/engine/6000.0/script-reference/unityengine/wsa/tile.md)s with additonal properties at the given XYZ coordinates of the corresponding cells in the [Tilemap](/engine/6000.0/script-reference/unityengine/tilemaps/tilemap.md). The Color and Transform of the [TileChangeData](/engine/6000.0/script-reference/unityengine/tilemaps/tilechangedata.md) will take precedence over the values from the [Tile](/engine/6000.0/script-reference/unityengine/wsa/tile.md).

```csharp
public void SetTiles(TileChangeData[] tileChangeDataArray, bool ignoreLockFlags)
```

### Parameters

**** (\[TileChangeData\[]]\(/engine/6000.0/script-reference/unityengine/tilemaps/tilechangedata)): The array of [Tile](/engine/6000.0/script-reference/unityengine/wsa/tile.md)s with additional properties to place.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to ignore Lock Flags set in the Tile's TileFlags when applying Color and Transform changes from [TileChangeData](/engine/6000.0/script-reference/unityengine/tilemaps/tilechangedata.md).

### Remarks

Refer to Scriptable Tiles and Tilemap for more information.
