# SwapTile(TileBase, TileBase)

> Swaps all existing Tile s of changeTile to newTile and refreshes all the swapped Tile s.

## Definition

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

```csharp
public void SwapTile(TileBase changeTile, TileBase newTile)
```

### Parameters

**** (\[TileBase]\(/engine/6000.6/script-reference/unityengine/tilemaps/tilebase)): Tile to swap.**** (\[TileBase]\(/engine/6000.6/script-reference/unityengine/tilemaps/tilebase)): Tile to swap to.

### Remarks

```csharp
// Change all occurences of tileA into tileB
using UnityEngine;
using UnityEngine.Tilemaps;

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

    void Start()
    {
        Tilemap tilemap = GetComponent<Tilemap>();
        tilemap.SwapTile(tileA, tileB);
    }
}
```

Refer to Scriptable Tiles and Tilemap for more information.
