Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

Tilemap.tilemapChanged

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

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