/// <summary> /// Force an update of all tilechunks. This is called after changing sensitive data like CellSize, Collider depth, etc /// </summary> /// <param name="refreshMesh"></param> /// <param name="refreshMeshCollider"></param> public void Refresh(bool refreshMesh = true, bool refreshMeshCollider = true, bool refreshTileObjects = false, bool invalidateBrushes = false) { BuildTilechunkDictionary(); var valueIter = m_dicChunkCache.Values.GetEnumerator(); while (valueIter.MoveNext()) { TilemapChunk chunk = valueIter.Current; if (chunk) { if (refreshMesh) { chunk.InvalidateMesh(); } if (refreshMeshCollider) { chunk.InvalidateMeshCollider(); } if (refreshTileObjects) { chunk.RefreshTileObjects(); } if (invalidateBrushes) { chunk.InvalidateBrushes(); } } } UpdateMesh(); }
/// <summary> /// Force an update of all tilechunks. This is called after changing sensitive data like CellSize, Collider depth, etc /// </summary> /// <param name="refreshMesh"></param> /// <param name="refreshMeshCollider"></param> public void Refresh(bool refreshMesh = true, bool refreshMeshCollider = true, bool refreshTileObjects = false, bool invalidateBrushes = false) { for (int i = 0; i < transform.childCount; ++i) { TilemapChunk chunk = transform.GetChild(i).GetComponent <TilemapChunk>(); if (chunk != null) { if (refreshMesh) { chunk.InvalidateMesh(); } if (refreshMeshCollider) { chunk.InvalidateMeshCollider(); } if (refreshTileObjects) { chunk.RefreshTileObjects(); } if (invalidateBrushes) { chunk.InvalidateBrushes(); } } } UpdateMesh(); }