tilemapChanged
Callback when a Tilemap itself has changed, rather than the Tiles on it.
Read time 1 minuteLast updated 7 days ago
Definition
- Type: Event
- Namespace: UnityEngine.Tilemaps
- Assembly: UnityEngine.TilemapModule
[NoAutoStaticsCleanup]public static event Action<Tilemap, TilemapChangeReason> tilemapChanged
Remarks
This returns why the Tilemap changed, for map-wide changes such as the tile anchor, orientation, cell layout, origin or size.
Examples
// Rebuild when a Tilemap changes in a way which moves the geometry of its cellsusing 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}"); }}