OpenFL 6.0 Tilemap

I just upgrade to OpenFL 6.0 and notice that tilemap now works in my project wrong.
I see changing in function removeTile().
in old version it use array remover:

	public function removeTile (tile:Tile):Tile {
		__tiles.remove (tile);
		__dirty = true;
		numTiles = __tiles.length;
		return tile;
	}

and now it is just mark as null

   ...
		for (i in 0...__tiles.length) {
			
			if (__tiles[i] == tile) {
				__tiles[i] = null;
				tile.parent = null;
			}
			
		}
   ...

but it length of tiles does not change, and tiles not reordering!..
so after using removeTile() i may see such straged traces:

trace(tilemap.numTiles); // 1
trace(tilemap.getTileAt(0)); // null

Is it bug or new feature?

This looks like a bug

We used to have a __tiles array, and this was the only thing used when rendering Tilemap. Now we render using TileArray, and may (or may not) have Tile objects that represent each entry in the TileArray.

We’ll try and get a fix out soon!

Try this: https://github.com/openfl/openfl/commit/0dd135691f5eb57d8910c5aecbc989bda5ce5ce3

it doesn’t help, because numTiles does not change…

	public function removeTile (tile:Tile):Tile {
		
		var cacheLength = __tiles.length;
		
		for (i in 0...__tiles.length) {
			
			if (__tiles[i] == tile) {
				tile.parent = null;
				__tiles.splice (i, 1);
				break;
			}
			
		}
		
		__tileArrayDirty = true;
		
		if (cacheLength < __tiles.length) {
			numTiles--;
		}
		
		#if !flash
		__setRenderDirty ();
		#end
		
		return tile;
		
	}
	

IMHO

if (cacheLength < __tiles.length) {  

must be reaplaced by

if (cacheLength > __tiles.length) {

also function addTileAt has such wrong condition (code work never):
(lines 91-93)

		if (cacheLength < __tiles.length) {
			index--;
		}

but in addTileAt this code need to be reaplaced by check if index was more then old tile index

Thanks! Fixed on GIT, sorry our tests didn’t catch this :sweat_smile: