Callback when a Tilemap itself has changed, rather than the Tiles on it.
This returns why the Tilemap changed, for map-wide changes such as the tile anchor, orientation, cell layout, origin or size.
// Rebuild when a Tilemap changes in a way which moves the geometry of its cells using UnityEngine; using UnityEngine.Tilemaps;
public class ExampleClass : MonoBehaviour { void OnEnable() { Tilemap.tilemapChanged += OnTilemapChanged; }
void OnDisable() { Tilemap.tilemapChanged -= OnTilemapChanged; }
void OnTilemapChanged(Tilemap tilemap, TilemapChangeReason reason) { if ((reason & TilemapChangeReason.Geometry) != 0) Debug.Log($"{tilemap.name} changed: {reason}"); } }