文档

Unity Engine

Unity Engine

tilemapChanged

Callback when a Tilemap itself has changed, rather than the Tiles on it.
阅读时间1 分钟最后更新于 1 个月前

Definition

[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}"); }}