public void RemoveAllOverlays(Vector3Int cellPosition, LayerType layerType, bool onlyIfCleanable = false) { cellPosition.z = 0; var overlayPos = metaTileMap.GetAllOverlayPos(cellPosition, layerType); if (overlayPos == null || overlayPos.Count == 0) { return; } foreach (var overlay in overlayPos) { cellPosition = overlay; if (onlyIfCleanable) { //only remove it if it's a cleanable tile var tile = metaTileMap.GetTile(cellPosition, layerType) as OverlayTile; //it's not an overlay tile or it's not cleanable so don't remove it if (tile == null || !tile.IsCleanable) { continue; } } InternalRemoveTile(cellPosition, layerType); SpawnSafeThread.RemoveTileMessageSend(networkMatrix.MatrixSync.netId, cellPosition, layerType); AddToChangeList(cellPosition, layerType); } }