Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SwapTile(TileBase, TileBase)

Swaps all existing Tile s of changeTile to newTile and refreshes all the swapped Tile s.
Read time 1 minuteLast updated 6 days ago

Definition

public void SwapTile(TileBase changeTile, TileBase newTile)

Parameters

changeTile

Tile to swap.

newTile

Tile to swap to.

Remarks

Refer to Scriptable Tiles and Tilemap for more information.

Examples

// Change all occurences of tileA into tileBusing UnityEngine;using UnityEngine.Tilemaps;public class ExampleClass : MonoBehaviour{ public TileBase tileA; public TileBase tileB; void Start() { Tilemap tilemap = GetComponent<Tilemap>(); tilemap.SwapTile(tileA, tileB); }}